summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Monjalon <thomas.monjalon@6wind.com>2013-09-13 14:14:02 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-01-15 18:11:17 +0100
commitbc7031e0e64f476336e188384b83fbbecfe49a74 (patch)
treedd876714359da1eddf3cc6ddaa05cbafb3daadb6 /lib
parentca18abb1e79acddcc296980d3926da02363f4cee (diff)
downloaddpdk-bc7031e0e64f476336e188384b83fbbecfe49a74.zip
dpdk-bc7031e0e64f476336e188384b83fbbecfe49a74.tar.gz
dpdk-bc7031e0e64f476336e188384b83fbbecfe49a74.tar.xz
ethdev: fix non-reconfigurable pmd init
Some Poll-Mode Drivers (PMD) are not reconfigurable and, thus, do not implement (rx|tx)_queue_release functions. For these drivers, the functions rte_eth_dev_(rx|tx)_queue_config must return an ENOTSUP error only when reconfiguring, but not at initial configuration. Move the FUNC_PTR_OR_ERR_RET check into the case of reconfiguration. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Ivan Boule <ivan.boule@6wind.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_ether/rte_ethdev.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index bfa7a00..859ec92 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -261,9 +261,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
void **rxq;
unsigned i;
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
-
- if (dev->data->rx_queues == NULL) {
+ if (dev->data->rx_queues == NULL) { /* first time configuration */
dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
sizeof(dev->data->rx_queues[0]) * nb_queues,
CACHE_LINE_SIZE);
@@ -271,7 +269,9 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
dev->data->nb_rx_queues = 0;
return -(ENOMEM);
}
- } else {
+ } else { /* re-configure */
+ FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
+
rxq = dev->data->rx_queues;
for (i = nb_queues; i < old_nb_queues; i++)
@@ -299,9 +299,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
void **txq;
unsigned i;
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
-
- if (dev->data->tx_queues == NULL) {
+ if (dev->data->tx_queues == NULL) { /* first time configuration */
dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
sizeof(dev->data->tx_queues[0]) * nb_queues,
CACHE_LINE_SIZE);
@@ -309,7 +307,9 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
dev->data->nb_tx_queues = 0;
return -(ENOMEM);
}
- } else {
+ } else { /* re-configure */
+ FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
+
txq = dev->data->tx_queues;
for (i = nb_queues; i < old_nb_queues; i++)