DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 3/6] net/nfp: remove the flower service dead loop
Date: Wed, 19 Jun 2024 11:06:52 +0800	[thread overview]
Message-ID: <20240619030655.3216268-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240619030655.3216268-1-chaoyong.he@corigine.com>

From: Long Wu <long.wu@corigine.com>

The flower service does not require high real-time performance,
so remove the dead loop to share service core with other services.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_service.c | 29 +++++++++------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_service.c b/drivers/net/nfp/flower/nfp_flower_service.c
index 515b4abef0..64753f5bf6 100644
--- a/drivers/net/nfp/flower/nfp_flower_service.c
+++ b/drivers/net/nfp/flower/nfp_flower_service.c
@@ -34,28 +34,25 @@ nfp_flower_service_handle_get(struct nfp_net_hw_priv *hw_priv)
 }
 
 static int
-nfp_flower_service_loop(void *arg)
+nfp_flower_service_func(void *arg)
 {
 	uint16_t slot;
 	struct nfp_app_fw_flower *app;
 	struct nfp_flower_service *service_handle;
 
 	service_handle = arg;
-	/* Waiting for enabling service */
-	while (!service_handle->enabled)
-		rte_delay_ms(1);
-
-	while (rte_service_runstate_get(service_handle->info.id) != 0) {
-		rte_spinlock_lock(&service_handle->spinlock);
-		for (slot = 0; slot < MAX_FLOWER_SERVICE_SLOT; slot++) {
-			app = service_handle->slots[slot];
-			if (app == NULL)
-				continue;
-
-			nfp_flower_ctrl_vnic_process(app);
-		}
-		rte_spinlock_unlock(&service_handle->spinlock);
+	if (!service_handle->enabled)
+		return 0;
+
+	rte_spinlock_lock(&service_handle->spinlock);
+	for (slot = 0; slot < MAX_FLOWER_SERVICE_SLOT; slot++) {
+		app = service_handle->slots[slot];
+		if (app == NULL)
+			continue;
+
+		nfp_flower_ctrl_vnic_process(app);
 	}
+	rte_spinlock_unlock(&service_handle->spinlock);
 
 	return 0;
 }
@@ -67,7 +64,7 @@ nfp_flower_service_enable(struct nfp_flower_service *service_handle)
 
 	const struct rte_service_spec flower_service = {
 		.name              = "flower_ctrl_vnic_service",
-		.callback          = nfp_flower_service_loop,
+		.callback          = nfp_flower_service_func,
 		.callback_userdata = (void *)service_handle,
 	};
 
-- 
2.39.1


  parent reply	other threads:[~2024-06-19  3:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19  3:06 [PATCH 0/6] refactor the service module Chaoyong He
2024-06-19  3:06 ` [PATCH 1/6] net/nfp: fix check logic for device arguments Chaoyong He
2024-06-19  3:06 ` [PATCH 2/6] net/nfp: remove redundant NFP service code Chaoyong He
2024-06-19  3:06 ` Chaoyong He [this message]
2024-06-19  3:06 ` [PATCH 4/6] net/nfp: fix disable CPP service Chaoyong He
2024-06-19  3:06 ` [PATCH 5/6] net/nfp: add CPP service enable option Chaoyong He
2024-06-19  3:06 ` [PATCH 6/6] net/nfp: add CPP service abnormal exit logic Chaoyong He

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=20240619030655.3216268-4-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    /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).