RE: [EXTERNAL] [PATCH v5 3/4] eal/linux: report uevent socket overrun

Long Li <[email protected]>
Newsgroups org.dpdk.dev
Message-ID <SA1PR21MB6683CD698B27DA7C7C31DAF9CEA42@SA1PR21MB6683.namprd21.prod.outlook.com>
> 
> Make uevent handler handle case where kernel netlink receive buffer is
> overrun. If this happens the DPDK device state will potentially be out of sync,
> but better not to give up.
> 
> The code already handles the case of kernel sending a zero length message; it
> just ignores it.
> 
> Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")
> Cc: [email protected]
> 
> Reported-by: Randy Tice <[email protected]>
> Signed-off-by: Stephen Hemminger <[email protected]>

Reviewed-by: Long Li <[email protected]>


> ---
>  lib/eal/linux/eal_dev.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index
> fb5c8bf070..b535122ff6 100644
> --- a/lib/eal/linux/eal_dev.c
> +++ b/lib/eal/linux/eal_dev.c
> @@ -270,11 +270,20 @@ 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)
> -		return;
> -	else if (ret <= 0) {
> -		/* connection is closed or broken, can not up again. */
> -		EAL_LOG(ERR, "uevent socket connection is broken.");
> +	if (ret < 0) {
> +		/* transient error */
> +		if (errno == EAGAIN || errno == EWOULDBLOCK || errno ==
> EINTR)
> +			return;
> +
> +		/* kernel netlink messages lost */
> +		if (errno == ENOBUFS) {
> +			EAL_LOG(NOTICE, "kernel receive buffer overrun");
> +			return;
> +		}
> +
> +		EAL_LOG(ERR, "unexpected error on uevent recv: %s",
> +			strerror(errno));
> +
>  		rte_eal_alarm_set(1, dev_delayed_unregister, NULL);
>  		return;
>  	}
> --
> 2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.