net/nfp: fix CPP bridge service exit
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: bab0e6f48b
("net/nfp: fix infinite loop")
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
This commit is contained in:
parent
39d82d2098
commit
a5b876a5aa
@ -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__);
|
||||
|
Loading…
Reference in New Issue
Block a user