patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
To: david.hunt@intel.com
Cc: dev@dpdk.org,
	Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>,
	alan.carew@intel.com, stable@dpdk.org
Subject: [PATCH] examples/vm_power: replace list foreach with while loop
Date: Tue,  1 Mar 2022 14:53:13 +0000	[thread overview]
Message-ID: <20220301145313.560577-1-shibin.koikkara.reeny@intel.com> (raw)

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


             reply	other threads:[~2022-03-01 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 14:53 Shibin Koikkara Reeny [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220301145313.560577-1-shibin.koikkara.reeny@intel.com \
    --to=shibin.koikkara.reeny@intel.com \
    --cc=alan.carew@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).