Skip to contentSkip to conversation

examples/guest_cli: fix hardcoded lcoreid

PATCH In review Hajkowski 2 participants 2 messages Mar 28, 2019 – Apr 1, 2019

lore
Share & tools
lore

Hajkowski

author
#0 lore raw

PATCH 1/1 examples/guest_cli: fix hardcoded lcoreid

From: Marcin Hajkowski <[email protected]>

In current implementation lcoreid 1 is used regardless of currently available cores. This change introduce dynamic core selection for sending policy.

Fixes d191f08533 ("examples/guest_cli: add send policy to host")
---
 .../vm_power_manager/guest_cli/vm_power_cli_guest.c    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +9 -1
index 2d9e7689a..bd3cee904 100644
@@ -188,8 +188,16 @@ static inline int
 send_policy(struct channel_packet *pkt)
 {
 	int ret;
+	unsigned int lcore_id;
 
-	ret = rte_power_guest_channel_send_msg(pkt, 1);
+	/* Get first enabled lcore. */
+	lcore_id = rte_get_next_lcore(-1,
+			0,
+			0);
+	if (lcore_id == RTE_MAX_LCORE)
+		return -1;
+
+	ret = rte_power_guest_channel_send_msg(pkt, lcore_id);
 	if (ret == 0)
 		return 1;
 	RTE_LOG(DEBUG, POWER, "Error sending message: %s\n",
Signature · 1 line
2.17.2
#1 lore raw

examples/vm_power_manager/guest_cli/vm_power_cli_guest.c static inline int · line 198

Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Hajkowski

examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +2 -0
+	if (lcore_id == RTE_MAX_LCORE)
+		return -1;

This check is already performed by rte_power_guest_channel_send_msg(). So it would be redundant here.

Thanks,
Reshma