[PATCH v3 01/26] net/nfp: fix the app stuck by CPP bridge service
Chaoyong He
chaoyong.he at corigine.com
Tue Oct 25 09:58:53 CEST 2022
The CPP (Command Pull Push) bridge service is needed for some debug
tools, but if no debug tools has ever been run, the initial logic of
CPP bridge service will block in accept() function call, and the
DPDK app can't exit normally.
Fixes: 678648abc64c ("net/nfp: fix service stuck on application exit")
Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
---
drivers/net/nfp/nfp_cpp_bridge.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c
index db4b781302..e650fe9930 100644
--- a/drivers/net/nfp/nfp_cpp_bridge.c
+++ b/drivers/net/nfp/nfp_cpp_bridge.c
@@ -379,6 +379,7 @@ nfp_cpp_bridge_service_func(void *args)
struct nfp_cpp *cpp;
struct nfp_pf_dev *pf_dev;
int sockfd, datafd, op, ret;
+ struct timeval timeout = {1, 0};
unlink("/tmp/nfp_cpp");
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -388,6 +389,8 @@ nfp_cpp_bridge_service_func(void *args)
return -EIO;
}
+ setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout));
+
memset(&address, 0, sizeof(struct sockaddr));
address.sa_family = AF_UNIX;
@@ -415,6 +418,9 @@ nfp_cpp_bridge_service_func(void *args)
while (rte_service_runstate_get(pf_dev->cpp_bridge_id) != 0) {
datafd = accept(sockfd, NULL, NULL);
if (datafd < 0) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK)
+ continue;
+
RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n",
__func__, errno);
RTE_LOG(ERR, PMD, "%s: service failed\n", __func__);
--
2.29.3
More information about the dev
mailing list