net/rpmsg: return ENOLINK upon Rx on errored sockets
The rpmsg_proto driver is used to provide a socket interface to
userspace under the AF_RPMSG address family, and is used by the TI
IPC MessageQ stack. The rpmsg proto driver creates a rpmsg channel
device per remote processor (a Rx socket) for each MessageQ object
through the socket's bind() call. These rpmsg channel devices are
cleaned up normally either when the userspace application closes
them or through the automatic cleanup of the file descriptors when
a process is terminated/closed. These devices can also be cleaned
up by the rpmsg_proto driver as part of the error recovery of a
remote processor, with the parent Rx sockets simply marked with
the error status RPMSG_ERROR.
This error status is not currently being returned to the userspace
in the socket's recvfrom() interface. Fix this by specifically
checking for this error status, and returning an error value of
ENOLINK back to userspace. The ENOLINK error code is used to allow
the userspace to differentiate this terminal error from other errors
on the Rx sockets and take appropriate action. This error code on
Rx sockets serves the same as the error code ESHUTDOWN used for Tx
sockets, and is chosen specifically to have a meaningful strerror
message appropriate to Rx sockets.
Signed-off-by:
Suman Anna <s-anna@ti.com>
Loading
Please sign in to comment