patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] examples/vm_power: replace list foreach with while loop
@ 2022-03-01 14:53 Shibin Koikkara Reeny
  2022-03-08 13:26 ` Thomas Monjalon
  2022-03-21  9:33 ` [PATCH v2] examples/vm_power: add support for list_foreach_safe Shibin Koikkara Reeny
  0 siblings, 2 replies; 9+ messages in thread
From: Shibin Koikkara Reeny @ 2022-03-01 14:53 UTC (permalink / raw)
  To: david.hunt; +Cc: dev, Shibin Koikkara Reeny, alan.carew, stable

Linux header files don't support LIST_FOREACH_SAFE so replacing
LIST_FOREACH with while loop.

Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")
Cc: alan.carew@intel.com
Cc: stable@dpdk.org

Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
---
 examples/vm_power_manager/channel_manager.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index 838465ab4b..b4dea4b275 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -1005,10 +1005,10 @@ channel_manager_exit(void)
 {
 	unsigned i;
 	char mask[RTE_MAX_LCORE];
-	struct virtual_machine_info *vm_info;
-
-	LIST_FOREACH(vm_info, &vm_list_head, vms_info) {
+	struct virtual_machine_info *vm_info = LIST_FIRST(&vm_list_head);
 
+	/* No LIST_FOREACH_SAFE, using while instead. */
+	while (vm_info) {
 		rte_spinlock_lock(&(vm_info->config_spinlock));
 
 		memcpy(mask, (char *)vm_info->channel_mask, RTE_MAX_LCORE);
@@ -1024,6 +1024,8 @@ channel_manager_exit(void)
 
 		LIST_REMOVE(vm_info, vms_info);
 		rte_free(vm_info);
+
+		vm_info = LIST_NEXT((vm_info), vms_info);
 	}
 
 	if (global_hypervisor_available) {
-- 
2.25.1


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

end of thread, other threads:[~2022-03-25 14:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 14:53 [PATCH] examples/vm_power: replace list foreach with while loop Shibin Koikkara Reeny
2022-03-08 13:26 ` Thomas Monjalon
2022-03-10  9:32   ` Koikkara Reeny, Shibin
2022-03-10  9:39     ` Thomas Monjalon
2022-03-10 17:21     ` Stephen Hemminger
2022-03-21  9:33 ` [PATCH v2] examples/vm_power: add support for list_foreach_safe Shibin Koikkara Reeny
2022-03-21 16:16   ` Stephen Hemminger
2022-03-22 14:43   ` [PATCH v3] " Shibin Koikkara Reeny
2022-03-25 14:02     ` David Hunt

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).