[PATCH v4] eal/linux: harden uevent recv error handling
Randy Tice <[email protected]>
| Newsgroups | org.dpdk.dev |
|---|---|
| Message-ID | <[email protected]> |
The Linux uevent handler is harded for non-blocking receive behavior and transient ENOBUF issue during hot plug/unplug testing with MANA. Signed-off-by: Randy Tice <[email protected]> --- v4: Wrong patch submitted v3: Fixed build issue with bitwise operator vs test against errno. v2: Addressed review comments regarding spelling and missing code comments. Limited the transient memory issue to just ENOBUF which was the only original error observed. --- lib/eal/linux/eal_dev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index ec408649d0..5b3e9dea9f 100644 --- a/lib/eal/linux/eal_dev.c +++ b/lib/eal/linux/eal_dev.c @@ -241,9 +241,16 @@ dev_uev_handler(__rte_unused void *param) ret = recv(rte_intr_fd_get(intr_handle), buf, EAL_UEV_MSG_LEN, MSG_DONTWAIT); - if (ret < 0 && errno == EAGAIN) + if (ret < 0 && + (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) { + /* non-blocking or interrupted */ return; - else if (ret <= 0) { + } else if (ret < 0 && (errno == ENOBUFS)) { + /* non-fatal transient memory condition */ + EAL_LOG(ERR, "unexpected error on uevent recv: %s", + strerror(errno)); + return; + } else if (ret <= 0) { /* connection is closed or broken, can not up again. */ EAL_LOG(ERR, "uevent socket connection is broken."); rte_eal_alarm_set(1, dev_delayed_unregister, NULL); -- 2.51.0