[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <64cc6a55-fa3f-42c3-b6b2-cd0da18cdeeb@quicinc.com>
Date: Tue, 22 Oct 2024 22:06:55 -0700
From: Chris Lew <quic_clew@...cinc.com>
To: Denis Kenzior <denkenz@...il.com>, <netdev@...r.kernel.org>
CC: Marcel Holtmann <marcel@...tmann.org>, Andy Gross <agross@...nel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
"David S. Miller"
<davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, <linux-arm-msm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v1 07/10] net: qrtr: allow socket endpoint binding
On 10/18/2024 11:18 AM, Denis Kenzior wrote:
> Introduce the ability to bind a QIPCRTR family socket to a specific
> endpoint. When a socket is bound, only messages from the bound
> endpoint can be received, and any messages sent from the socket are
> by default directed to the bound endpoint. Clients can bind a socket
> by using the setsockopt system call with the QRTR_BIND_ENDPOINT option
> set to the desired endpoint binding.
>
> A previously set binding can be reset by setting QRTR_BIND_ENDPOINT
> option to zero. This behavior matches that of SO_BINDTOIFINDEX.
>
> This functionality is useful for clients that need to communicate
> with a specific device (i.e. endpoint), such as a PCIe-based 5G modem,
> and are not interested in messages from other endpoints / nodes.
>
> Signed-off-by: Denis Kenzior <denkenz@...il.com>
> Reviewed-by: Marcel Holtmann <marcel@...tmann.org>
> Reviewed-by: Andy Gross <agross@...nel.org>
> ---
> include/uapi/linux/qrtr.h | 1 +
> net/qrtr/af_qrtr.c | 54 ++++++++++++++++++++++++++++-----------
> 2 files changed, 40 insertions(+), 15 deletions(-)
>
...
> @@ -1313,6 +1331,9 @@ static int qrtr_setsockopt(struct socket *sock, int level, int optname,
> case QRTR_REPORT_ENDPOINT:
> assign_bit(QRTR_F_REPORT_ENDPOINT, &ipc->flags, val);
> break;
> + case QRTR_BIND_ENDPOINT:
> + ipc->bound_endpoint = val;
> + break;
> default:
> rc = -ENOPROTOOPT;
> }
> @@ -1346,6 +1367,9 @@ static int qrtr_getsockopt(struct socket *sock, int level, int optname,
> case QRTR_REPORT_ENDPOINT:
> val = test_bit(QRTR_F_REPORT_ENDPOINT, &ipc->flags);
> break;
> + case QRTR_BIND_ENDPOINT:
> + val = ipc->bound_endpoint;
> + break;
In the case where an endpoint goes away and a client has bound their
socket to an endpoint, would there be any notification to unbind the socket?
Is the expectation that the client would get notified through ECONNRESET
on the next sendmsg() or receive the BYE/DEL_CLIENT/DEL_SERVER control
message.
On that cleanup, I guess the client would either re-bind the socket back
to 0 or wait for the mhi sysfs to come back and get the new endpoint id?
> default:
> rc = -ENOPROTOOPT;
> }
Powered by blists - more mailing lists