Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Chris Lew <quic_clew@quicinc.com>
To: Denis Kenzior <denkenz@gmail.com>, <netdev@vger.kernel.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Andy Gross <agross@kernel.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v1 07/10] net: qrtr: allow socket endpoint binding
Date: Tue, 22 Oct 2024 22:06:55 -0700	[thread overview]
Message-ID: <64cc6a55-fa3f-42c3-b6b2-cd0da18cdeeb@quicinc.com> (raw)
In-Reply-To: <20241018181842.1368394-8-denkenz@gmail.com>



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@gmail.com>
> Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
> Reviewed-by: Andy Gross <agross@kernel.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;
>   	}

  reply	other threads:[~2024-10-23  5:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 18:18 [RFC PATCH v1 00/10] QRTR Multi-endpoint support Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 01/10] net: qrtr: ns: validate msglen before ctrl_pkt use Denis Kenzior
2024-10-22  4:27   ` Chris Lew
2024-10-22 14:23     ` Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 02/10] net: qrtr: allocate and track endpoint ids Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 03/10] net: qrtr: support identical node ids Denis Kenzior
2024-10-19  9:18   ` Simon Horman
2024-10-22 14:24     ` Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 04/10] net: qrtr: Report sender endpoint in aux data Denis Kenzior
2024-10-19  0:22   ` Kuniyuki Iwashima
2024-10-22 15:07     ` Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 05/10] net: qrtr: Report endpoint for locally generated messages Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 06/10] net: qrtr: Allow sendmsg to target an endpoint Denis Kenzior
2024-10-22 23:58   ` Chris Lew
2024-10-24 17:40     ` Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 07/10] net: qrtr: allow socket endpoint binding Denis Kenzior
2024-10-23  5:06   ` Chris Lew [this message]
2024-10-24 17:51     ` Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 08/10] net: qrtr: Drop remote {NEW|DEL}_LOOKUP messages Denis Kenzior
2024-10-23  0:36   ` Chris Lew
2024-10-24 18:03     ` Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 09/10] net: qrtr: ns: support multiple endpoints Denis Kenzior
2024-10-18 18:18 ` [RFC PATCH v1 10/10] net: qrtr: mhi: Report endpoint id in sysfs Denis Kenzior
2024-10-23  0:25   ` Chris Lew
2024-10-24 18:06     ` Denis Kenzior
2024-10-22 15:39 ` [RFC PATCH v1 00/10] QRTR Multi-endpoint support Manivannan Sadhasivam
2024-10-22 15:46   ` Denis Kenzior
2024-10-23  5:07 ` Chris Lew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64cc6a55-fa3f-42c3-b6b2-cd0da18cdeeb@quicinc.com \
    --to=quic_clew@quicinc.com \
    --cc=agross@kernel.org \
    --cc=davem@davemloft.net \
    --cc=denkenz@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox