From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: Arun Kumar Neelakantam <aneela@codeaurora.org>,
netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Courtney Cavin <ccavin@gmail.com>
Subject: [RESEND PATCH 4/4] net: qrtr: Inform open sockets about new controller
Date: Wed, 7 Jun 2017 14:07:39 -0700 [thread overview]
Message-ID: <20170607210739.27263-5-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20170607210739.27263-1-bjorn.andersson@linaro.org>
As the higher level communication only deals with "services" the
a service directory is required to keep track of local and remote
services. In order for qrtr clients to be informed about when the
service directory implementation is available some event needs to be
passed to them.
Rather than introducing support for broadcasting such a message in-band
to all open local sockets we flag each socket with ENETRESET, as there
are no other expected operations that would benefit from having support
from locally broadcasting messages.
Cc: Courtney Cavin <ccavin@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
net/qrtr/qrtr.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index d7516098b5aa..c7a5d861906b 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -530,6 +530,26 @@ static int qrtr_port_assign(struct qrtr_sock *ipc, int *port)
return 0;
}
+/* Reset all non-control ports */
+static void qrtr_reset_ports(void)
+{
+ struct qrtr_sock *ipc;
+ int id;
+
+ mutex_lock(&qrtr_port_lock);
+ idr_for_each_entry(&qrtr_ports, ipc, id) {
+ /* Don't reset control port */
+ if (id == 0)
+ continue;
+
+ sock_hold(&ipc->sk);
+ ipc->sk.sk_err = ENETRESET;
+ wake_up_interruptible(sk_sleep(&ipc->sk));
+ sock_put(&ipc->sk);
+ }
+ mutex_unlock(&qrtr_port_lock);
+}
+
/* Bind socket to address.
*
* Socket should be locked upon call.
@@ -558,6 +578,10 @@ static int __qrtr_bind(struct socket *sock,
sock_reset_flag(sk, SOCK_ZAPPED);
+ /* Notify all open ports about the new controller */
+ if (port == QRTR_PORT_CTRL)
+ qrtr_reset_ports();
+
return 0;
}
--
2.12.0
next prev parent reply other threads:[~2017-06-07 21:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 21:07 [RESEND PATCH 0/4] Missing QRTR features Bjorn Andersson
2017-06-07 21:07 ` [RESEND PATCH 1/4] net: qrtr: Refactor packet allocation Bjorn Andersson
2017-06-07 21:07 ` [RESEND PATCH 2/4] net: qrtr: Inject BYE on remote termination Bjorn Andersson
2017-06-07 21:07 ` [RESEND PATCH 3/4] net: qrtr: Broadcast DEL_CLIENT message when endpoint is closed Bjorn Andersson
2017-06-07 21:07 ` Bjorn Andersson [this message]
2017-06-08 15:35 ` [RESEND PATCH 0/4] Missing QRTR features David Miller
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=20170607210739.27263-5-bjorn.andersson@linaro.org \
--to=bjorn.andersson@linaro.org \
--cc=aneela@codeaurora.org \
--cc=ccavin@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).