git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cryptodev: support device independent sessions
[dpdk.git]
/
drivers
/
net
/
virtio
/
virtio_ethdev.c
diff --git
a/drivers/net/virtio/virtio_ethdev.c
b/drivers/net/virtio/virtio_ethdev.c
index
73e5da8
..
5c826f4
100644
(file)
--- a/
drivers/net/virtio/virtio_ethdev.c
+++ b/
drivers/net/virtio/virtio_ethdev.c
@@
-71,7
+71,7
@@
static void virtio_dev_allmulticast_disable(struct rte_eth_dev *dev);
static void virtio_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int virtio_dev_link_update(struct rte_eth_dev *dev,
static void virtio_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int virtio_dev_link_update(struct rte_eth_dev *dev,
-
__rte_unused
int wait_to_complete);
+ int wait_to_complete);
static void virtio_set_hwaddr(struct virtio_hw *hw);
static void virtio_get_hwaddr(struct virtio_hw *hw);
static void virtio_set_hwaddr(struct virtio_hw *hw);
static void virtio_get_hwaddr(struct virtio_hw *hw);
@@
-87,18
+87,18
@@
static void virtio_dev_stats_reset(struct rte_eth_dev *dev);
static void virtio_dev_free_mbufs(struct rte_eth_dev *dev);
static int virtio_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
static void virtio_dev_free_mbufs(struct rte_eth_dev *dev);
static int virtio_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
-static
void
virtio_mac_addr_add(struct rte_eth_dev *dev,
+static
int
virtio_mac_addr_add(struct rte_eth_dev *dev,
struct ether_addr *mac_addr,
struct ether_addr *mac_addr,
- uint32_t index, uint32_t vmdq
__rte_unused
);
+ uint32_t index, uint32_t vmdq);
static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
static void virtio_mac_addr_set(struct rte_eth_dev *dev,
struct ether_addr *mac_addr);
static int virtio_dev_queue_stats_mapping_set(
static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
static void virtio_mac_addr_set(struct rte_eth_dev *dev,
struct ether_addr *mac_addr);
static int virtio_dev_queue_stats_mapping_set(
-
__rte_unused
struct rte_eth_dev *eth_dev,
-
__rte_unused
uint16_t queue_id,
-
__rte_unused
uint8_t stat_idx,
-
__rte_unused
uint8_t is_rx);
+ struct rte_eth_dev *eth_dev,
+ uint16_t queue_id,
+ uint8_t stat_idx,
+ uint8_t is_rx);
/*
* The set of PCI devices this driver supports
/*
* The set of PCI devices this driver supports
@@
-424,7
+424,7
@@
virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
}
}
}
}
- memset(mz->addr, 0,
sizeof(mz->len)
);
+ memset(mz->addr, 0,
mz->len
);
vq->vq_ring_mem = mz->phys_addr;
vq->vq_ring_virt_mem = mz->addr;
vq->vq_ring_mem = mz->phys_addr;
vq->vq_ring_virt_mem = mz->addr;
@@
-546,6
+546,9
@@
virtio_free_queues(struct virtio_hw *hw)
int queue_type;
uint16_t i;
int queue_type;
uint16_t i;
+ if (hw->vqs == NULL)
+ return;
+
for (i = 0; i < nr_vq; i++) {
vq = hw->vqs[i];
if (!vq)
for (i = 0; i < nr_vq; i++) {
vq = hw->vqs[i];
if (!vq)
@@
-564,9
+567,11
@@
virtio_free_queues(struct virtio_hw *hw)
}
rte_free(vq);
}
rte_free(vq);
+ hw->vqs[i] = NULL;
}
rte_free(hw->vqs);
}
rte_free(hw->vqs);
+ hw->vqs = NULL;
}
static int
}
static int
@@
-1020,7
+1025,7
@@
virtio_get_hwaddr(struct virtio_hw *hw)
}
}
}
}
-static
void
+static
int
virtio_mac_table_set(struct virtio_hw *hw,
const struct virtio_net_ctrl_mac *uc,
const struct virtio_net_ctrl_mac *mc)
virtio_mac_table_set(struct virtio_hw *hw,
const struct virtio_net_ctrl_mac *uc,
const struct virtio_net_ctrl_mac *mc)
@@
-1030,7
+1035,7
@@
virtio_mac_table_set(struct virtio_hw *hw,
if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
PMD_DRV_LOG(INFO, "host does not support mac table");
if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
PMD_DRV_LOG(INFO, "host does not support mac table");
- return;
+ return
-1
;
}
ctrl.hdr.class = VIRTIO_NET_CTRL_MAC;
}
ctrl.hdr.class = VIRTIO_NET_CTRL_MAC;
@@
-1045,9
+1050,10
@@
virtio_mac_table_set(struct virtio_hw *hw,
err = virtio_send_command(hw->cvq, &ctrl, len, 2);
if (err != 0)
PMD_DRV_LOG(NOTICE, "mac table set failed: %d", err);
err = virtio_send_command(hw->cvq, &ctrl, len, 2);
if (err != 0)
PMD_DRV_LOG(NOTICE, "mac table set failed: %d", err);
+ return err;
}
}
-static
void
+static
int
virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
uint32_t index, uint32_t vmdq __rte_unused)
{
virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
uint32_t index, uint32_t vmdq __rte_unused)
{
@@
-1058,7
+1064,7
@@
virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
if (index >= VIRTIO_MAX_MAC_ADDRS) {
PMD_DRV_LOG(ERR, "mac address index %u out of range", index);
if (index >= VIRTIO_MAX_MAC_ADDRS) {
PMD_DRV_LOG(ERR, "mac address index %u out of range", index);
- return;
+ return
-EINVAL
;
}
uc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(uc->entries));
}
uc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(uc->entries));
@@
-1075,7
+1081,7
@@
virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN);
}
memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN);
}
- virtio_mac_table_set(hw, uc, mc);
+
return
virtio_mac_table_set(hw, uc, mc);
}
static void
}
static void
@@
-1223,7
+1229,8
@@
virtio_interrupt_handler(void *param)
if (isr & VIRTIO_PCI_ISR_CONFIG) {
if (virtio_dev_link_update(dev, 0) == 0)
_rte_eth_dev_callback_process(dev,
if (isr & VIRTIO_PCI_ISR_CONFIG) {
if (virtio_dev_link_update(dev, 0) == 0)
_rte_eth_dev_callback_process(dev,
- RTE_ETH_EVENT_INTR_LSC, NULL);
+ RTE_ETH_EVENT_INTR_LSC,
+ NULL, NULL);
}
}
}
}
@@
-1349,7
+1356,7
@@
virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
return -1;
if (!hw->virtio_user_dev) {
return -1;
if (!hw->virtio_user_dev) {
- pci_dev = RTE_
DEV_TO_PCI(eth_dev->device
);
+ pci_dev = RTE_
ETH_DEV_TO_PCI(eth_dev
);
rte_eth_copy_pci_info(eth_dev, pci_dev);
}
rte_eth_copy_pci_info(eth_dev, pci_dev);
}
@@
-1479,7
+1486,7
@@
virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_hw *hw)
if (hw->modern) {
/*
* We don't have to re-parse the PCI config space, since
if (hw->modern) {
/*
* We don't have to re-parse the PCI config space, since
- * rte_
eal_
pci_map_device() makes sure the mapped address
+ * rte_pci_map_device() makes sure the mapped address
* in secondary process would equal to the one mapped in
* the primary process: error will be returned if that
* requirement is not met.
* in secondary process would equal to the one mapped in
* the primary process: error will be returned if that
* requirement is not met.
@@
-1488,12
+1495,12
@@
virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_hw *hw)
* (such as dev_cfg, common_cfg, etc.) parsed from the
* primary process, which is stored in shared memory.
*/
* (such as dev_cfg, common_cfg, etc.) parsed from the
* primary process, which is stored in shared memory.
*/
- if (rte_
eal_
pci_map_device(pci_dev)) {
+ if (rte_pci_map_device(pci_dev)) {
PMD_INIT_LOG(DEBUG, "failed to map pci device!");
return -1;
}
} else {
PMD_INIT_LOG(DEBUG, "failed to map pci device!");
return -1;
}
} else {
- if (rte_
eal_
pci_ioport_map(pci_dev, 0, VTPCI_IO(hw)) < 0)
+ if (rte_pci_ioport_map(pci_dev, 0, VTPCI_IO(hw)) < 0)
return -1;
}
return -1;
}
@@
-1531,8
+1538,7
@@
eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
if (!hw->virtio_user_dev) {
if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
if (!hw->virtio_user_dev) {
- ret = virtio_remap_pci(RTE_DEV_TO_PCI(eth_dev->device),
- hw);
+ ret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
if (ret)
return ret;
}
if (ret)
return ret;
}
@@
-1561,7
+1567,7
@@
eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
* virtio_user_eth_dev_alloc() before eth_virtio_dev_init() is called.
*/
if (!hw->virtio_user_dev) {
* virtio_user_eth_dev_alloc() before eth_virtio_dev_init() is called.
*/
if (!hw->virtio_user_dev) {
- ret = vtpci_init(RTE_
DEV_TO_PCI(eth_dev->device
), hw);
+ ret = vtpci_init(RTE_
ETH_DEV_TO_PCI(eth_dev
), hw);
if (ret)
return ret;
}
if (ret)
return ret;
}
@@
-1603,7
+1609,7
@@
eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
virtio_interrupt_handler,
eth_dev);
if (eth_dev->device)
virtio_interrupt_handler,
eth_dev);
if (eth_dev->device)
- rte_
eal_pci_unmap_device(RTE_DEV_TO_PCI(eth_dev->device
));
+ rte_
pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev
));
PMD_INIT_LOG(DEBUG, "dev_uninit completed");
PMD_INIT_LOG(DEBUG, "dev_uninit completed");
@@
-1641,7
+1647,7
@@
rte_virtio_pmd_init(void)
return;
}
return;
}
- rte_
eal_
pci_register(&rte_virtio_pmd);
+ rte_pci_register(&rte_virtio_pmd);
}
/*
}
/*
@@
-1888,7
+1894,7
@@
virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
- dev_info->pci_dev = dev->device ? RTE_
DEV_TO_PCI(dev->device
) : NULL;
+ dev_info->pci_dev = dev->device ? RTE_
ETH_DEV_TO_PCI(dev
) : NULL;
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
dev_info->max_rx_queues =
RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
dev_info->max_tx_queues =
@@
-1937,4
+1943,4
@@
__rte_unused uint8_t is_rx)
RTE_PMD_EXPORT_NAME(net_virtio, __COUNTER__);
RTE_PMD_REGISTER_PCI_TABLE(net_virtio, pci_id_virtio_map);
RTE_PMD_EXPORT_NAME(net_virtio, __COUNTER__);
RTE_PMD_REGISTER_PCI_TABLE(net_virtio, pci_id_virtio_map);
-RTE_PMD_REGISTER_KMOD_DEP(net_virtio, "* igb_uio | uio_pci_generic | vfio");
+RTE_PMD_REGISTER_KMOD_DEP(net_virtio, "* igb_uio | uio_pci_generic | vfio
-pci
");