[dpdk-dev] app/testpmd: Fix not set need_reconfig flag when port id is RTE_PORT_ALL

Message ID 1426214303-12207-1-git-send-email-yong.liu@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Marvin Liu March 13, 2015, 2:38 a.m. UTC
  When port id is RTE_PORT_ALL, port_id_is_invalid will also return zero.
So this function will only set ports[255] need_reconfig flag, other ports will
be skipped.

Signed-off-by: Marvin liu <yong.liu@intel.com>
  

Comments

Ouyang Changchun March 17, 2015, 1:18 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yong Liu
> Sent: Friday, March 13, 2015 10:38 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] app/testpmd: Fix not set need_reconfig flag
> when port id is RTE_PORT_ALL
> 
> When port id is RTE_PORT_ALL, port_id_is_invalid will also return zero.
> So this function will only set ports[255] need_reconfig flag, other ports will be
> skipped.
> 
> Signed-off-by: Marvin liu <yong.liu@intel.com>
> 

Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
  
Thomas Monjalon March 20, 2015, 11:26 p.m. UTC | #2
> > When port id is RTE_PORT_ALL, port_id_is_invalid will also return zero.
> > So this function will only set ports[255] need_reconfig flag, other ports will be
> > skipped.
> > 
> > Signed-off-by: Marvin liu <yong.liu@intel.com>
> 
> Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>

Fixes: edab33b1c01d ("app/testpmd: support port hotplug")

Applied, thanks
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5b16a69..077d7a4 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -8874,14 +8874,7 @@  prompt(void)
 static void
 cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue)
 {
-	if (!port_id_is_invalid(id, DISABLED_WARN)) {
-		/* check if need_reconfig has been set to 1 */
-		if (ports[id].need_reconfig == 0)
-			ports[id].need_reconfig = dev;
-		/* check if need_reconfig_queues has been set to 1 */
-		if (ports[id].need_reconfig_queues == 0)
-			ports[id].need_reconfig_queues = queue;
-	} else {
+	if (id == (portid_t)RTE_PORT_ALL) {
 		portid_t pid;
 
 		FOREACH_PORT(pid, ports) {
@@ -8892,6 +8885,13 @@  cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue)
 			if (ports[pid].need_reconfig_queues == 0)
 				ports[pid].need_reconfig_queues = queue;
 		}
+	} else if (!port_id_is_invalid(id, DISABLED_WARN)) {
+		/* check if need_reconfig has been set to 1 */
+		if (ports[id].need_reconfig == 0)
+			ports[id].need_reconfig = dev;
+		/* check if need_reconfig_queues has been set to 1 */
+		if (ports[id].need_reconfig_queues == 0)
+			ports[id].need_reconfig_queues = queue;
 	}
 }