From patchwork Wed Jun 7 18:55:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 103309 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2084262qgd; Wed, 7 Jun 2017 11:55:30 -0700 (PDT) X-Received: by 10.99.178.16 with SMTP id x16mr33722641pge.220.1496861730254; Wed, 07 Jun 2017 11:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496861730; cv=none; d=google.com; s=arc-20160816; b=hu8UXQPEKefsMS9/P0gX6PLxFaSF0xnSnDXT2MGkS8K6VaYFWPLGmBtyvMAhUd+mP+ vDhHgechNte+JK0/aNGd2Y1kwQ9wTPfDQABT7h5WVw8mIz+qPCbWMCWBYj2rTJ15djAw AAd7Uko9Y3SAVh0Nq+hFaWUICgOarYvQdU0KOIfmS2dMcfbneYkAXgmpUMt+Qt3saf61 S3GmWAZrLCJu1AQ2wc4By9Hj5y2Fi3lO915SyEXNSsMvzc9IjrYYPGyOd9G5hk+GrNQF 0c2sMiE5Cnnwq/904c4y7R0URurnrONSPSN8+ejD2rwDOoRlMXKBjkUIsiOQxkiOlNLw I8bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=0LPKQn7O6EM8KCGgtZCIZAlN695W5rgDPvZKWmqLZEY=; b=QSrqofVg1Lugt+J3hR4eOp0lL66+/KVMD2yFswW6iu/RJ62tbiIHbBQ/xkWhmqf5/u U0Kx+aLZJ8dspLKvwrIqSR1vQaHBlGZQFHW2jYUSFvzGftSgR9qanNj4NcwbI72NfR8a a4bbEMbcuFrnJsT9jZZh3CZ5a1M4Vtug8rRvTqQlGwHIdnu3rHmNSBJ82cvAlBaPQqkH tJqafNJ4XKQs4BGS2oz80GWjeFrng2QNw3zmznbDSpDKkjh1AlL7FUACA1uB+SSJ3ugz 1sZuinokTtLL3ldp4mmRD319sIzTDJRcbx3bylgP1DtWBIiYl2AXGsLEjVP+5onPivPU vBGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si2453857pgn.133.2017.06.07.11.55.29; Wed, 07 Jun 2017 11:55:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752001AbdFGSzM (ORCPT + 25 others); Wed, 7 Jun 2017 14:55:12 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:34623 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751909AbdFGSzJ (ORCPT ); Wed, 7 Jun 2017 14:55:09 -0400 Received: by mail-pf0-f171.google.com with SMTP id 9so8670399pfj.1 for ; Wed, 07 Jun 2017 11:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0LPKQn7O6EM8KCGgtZCIZAlN695W5rgDPvZKWmqLZEY=; b=UB3Pke/6mhuuJacIre0AlstOEcMmbNdDChvtKB2xwtYW1xuIavjyQMIn2xhDQMsnO0 g7kclhZJtxCG5F8P7rVBPa0AxraA2h5Y6Mujsw/3bm8T5P6P0Z4cP67uhL8O1VfgpdWF 4eZsmZYBWXKm2No9TAsPdslBxIq/KnvBCuxZI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0LPKQn7O6EM8KCGgtZCIZAlN695W5rgDPvZKWmqLZEY=; b=FgsnufFiQaM720KtqwcrRPDRpJKxbuArxaZyqsCEH3pWrazG/N/kDU08njm0b7A6i9 D1QTXOzmHmSugADD6DM/0SzPzxgDsVOfVpfNS9mKnScIbcfp86fKhnv42+s6/Gvcaq/F oPx/nn9dwVgeVyW0pNsjcwxR5NF8qhzSYArXQRxD7pC7oIxAWFpaa2LpIEYoe57Xt8q0 GjH+5oNNN1MkXLbGY7mAwHrws3zQJb06D/8X2GzfNFM+hJAX1+R1Dq6UNjN+lHsWYpx6 P0ECAb0XCl56PuWoPuY3/xvYvIUcNY4gk8wyV9Bcb9101lhb0ee3x0U9YZ4giVlnomW2 sEAw== X-Gm-Message-State: AODbwcAk4C+XCkcTbHwNSYlmUHZ+gNX/cPQYFBUKXsCesWe9mWt2ShzH TRW42RHe00QwIax7 X-Received: by 10.98.142.17 with SMTP id k17mr15335845pfe.139.1496861708902; Wed, 07 Jun 2017 11:55:08 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id u73sm5355149pfi.105.2017.06.07.11.55.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jun 2017 11:55:08 -0700 (PDT) From: Bjorn Andersson To: "David S. Miller" Cc: Arun Kumar Neelakantam , netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Courtney Cavin Subject: [PATCH 4/4] net: qrtr: Inform open sockets about new controller Date: Wed, 7 Jun 2017 11:55:01 -0700 Message-Id: <20170607185501.6000-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170607185501.6000-1-bjorn.andersson@linaro.org> References: <20170607185501.6000-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 Signed-off-by: Bjorn Andersson --- net/qrtr/qrtr.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) -- 2.12.0 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; }