DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost PMD: Fix wrong handling of maximum value of rx/tx queues
@ 2016-03-22  8:09 Tetsuya Mukawa
  2016-03-22 17:17 ` Loftus, Ciara
  0 siblings, 1 reply; 4+ messages in thread
From: Tetsuya Mukawa @ 2016-03-22  8:09 UTC (permalink / raw)
  To: dev, ciara.loftus
  Cc: ann.zhuangyanying, bruce.richardson, yuanhan.liu, Tetsuya Mukawa

Currently, the maximum value of rx/tx queueus are kept by EAL. But,
the value are used like below different meanings in vhost PMD.
 - The maximum value of current enabled queues.
 - The maximum value of current supported queues.

This wrong double meaning will cause an issue like below steps.

* Invoke application with below option.
  --vdev 'eth_vhost0,iface=<socket path>,queues=4'
* Configure queues like below.
  rte_eth_dev_configure(portid, 2, 2, ...);
* Configure queues again like below.
  rte_eth_dev_configure(portid, 4, 4, ...);

The second rte_eth_dev_configure() will be failed because both
the maximum value of current enabled queues and supported queues
will be '2' after calling first rte_eth_dev_configure().

To fix the issue, the patch prepare one more variable to keep the
number of maximum supported queues in vhost PMD.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 drivers/net/vhost/rte_eth_vhost.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 6b9d287..5fd8c70 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -88,6 +88,7 @@ struct vhost_queue {
 struct pmd_internal {
 	char *dev_name;
 	char *iface_name;
+	uint16_t max_queues;
 
 	volatile uint16_t once;
 };
@@ -555,11 +556,19 @@ static void
 eth_dev_info(struct rte_eth_dev *dev,
 	     struct rte_eth_dev_info *dev_info)
 {
+	struct pmd_internal *internal;
+
+	internal = dev->data->dev_private;
+	if (internal == NULL) {
+		RTE_LOG(ERR, PMD, "Invalid device specified\n");
+		return;
+	}
+
 	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
-	dev_info->max_rx_queues = dev->data->nb_rx_queues;
-	dev_info->max_tx_queues = dev->data->nb_tx_queues;
+	dev_info->max_rx_queues = internal->max_queues;
+	dev_info->max_tx_queues = internal->max_queues;
 	dev_info->min_rx_bufsize = 0;
 }
 
@@ -751,6 +760,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues,
 	memmove(data->name, eth_dev->data->name, sizeof(data->name));
 	data->nb_rx_queues = queues;
 	data->nb_tx_queues = queues;
+	internal->max_queues = queues;
 	data->dev_link = pmd_link;
 	data->mac_addrs = eth_addr;
 
-- 
2.1.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-23 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22  8:09 [dpdk-dev] [PATCH] vhost PMD: Fix wrong handling of maximum value of rx/tx queues Tetsuya Mukawa
2016-03-22 17:17 ` Loftus, Ciara
2016-03-23  1:07   ` Tetsuya Mukawa
2016-03-23 17:45   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).