From patchwork Wed Jun 7 18:55:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 103310 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2084411qgd; Wed, 7 Jun 2017 11:55:56 -0700 (PDT) X-Received: by 10.99.95.194 with SMTP id t185mr7649330pgb.19.1496861756417; Wed, 07 Jun 2017 11:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496861756; cv=none; d=google.com; s=arc-20160816; b=rqyESrd4FfA/yUsdK99IVHJjsweqHnUBIc5i91msPH2UJoO5MdLGHlwQPEgNVwn8Q1 cO4OrlBSInatEQTxCRDCCI/CSGJxwQvOtTB1+L1RxmJx0YslluFAWnF0sIy6ihEw0Z/s D578zXXUuWnNOODozAvm3EF/rYLzNrruV8PTqBIzx/0kzIniOa0POkT//lMK5DqOlKb5 ukPNCaf1TIOaSBcdKUhevjUgQ1+HF/xnAbiP5nFkfM1BPGsZ+5DpmnmsNs1e+l5l0Am3 EAXSO0oCd0ua02CcSbwrkKcrLkB4JZkkP7CZtYxzongzT5btaU5ZJ6KZqNI+mBdsC/hI wJdQ== 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=wsbAtJQRkV+WiCryejZUb4dPHA+7dvCq1BleeeWvY4Q=; b=VL+9cD4flwijGKVVZlg3Sx+/byDn8h4EsYzHZRrteJN5Hq81a9ePXl0ANjCY88Td6i L/7vXsBfetPFZYp9NGo8U3BFIndsXoIs1vlAS1Twtizfivrsi8Er/wNXRaPiESZdmIKc hxX5sLYNg4ZkgwnKa47n80mj0QaJ9KaSm2PFanK3rjDb5l2vaEwI/B1oJANdQNqrT/Oc S2WwzcPkeRa5NeNI0J0Z3vhk2C1g6uMI2kILpU2xgiFA6YMP575UhF3Z3/kB1KQFl9o0 BdGQPKVF3lMQidlvkZAiEkbP0utCMhJsS905g9pFarJ6djxeRN2RiviGKizO+zyOFxSI z3gA== 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 d7si2511469pln.460.2017.06.07.11.55.56; Wed, 07 Jun 2017 11:55:56 -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 S1752027AbdFGSzl (ORCPT + 25 others); Wed, 7 Jun 2017 14:55:41 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:36216 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751922AbdFGSzI (ORCPT ); Wed, 7 Jun 2017 14:55:08 -0400 Received: by mail-pg0-f45.google.com with SMTP id a70so8137620pge.3 for ; Wed, 07 Jun 2017 11:55:08 -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=wsbAtJQRkV+WiCryejZUb4dPHA+7dvCq1BleeeWvY4Q=; b=FLBVuQZVL7GdBcj3PX4+JP1vaYTfzGDWFmK9fcN9d4HM83zohg/1gaTC3btTNItd6Z tZBYtzPMqgx5ExEK42w2q2UucZzVHPZVpUihfN3RelgTtji4R/YTvhmzo0hTUQ5qB3+n Ms+A4DXxcjxN38a70yT/RSWy2+qBRJlFfZtp8= 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=wsbAtJQRkV+WiCryejZUb4dPHA+7dvCq1BleeeWvY4Q=; b=SauJ5FLjrFqq2PUOfi/q+0qwekmKm/6Hztt+323VBuvFXl5U0Mabap+vyp6e0tUsRN v1xXosHhdvYapfp+smpPt1dOORnKLIikfZvVecgDC3r6isIp5gdVO6M+drib3T9it7wp j4wDuBGpbWB7qmC6XOQJ1mgtFTnRKIvk+iOuInm6vp9mGfyiyhP5u0MdlCP1M/dqQEXf PqOW/d62rp97SbhjmRkbyhej4Krtp/XhHzkklkP184AKNtuBb1qbDXGyDnpjfXjixXfj h4jxzkzvMN43MLCammNpLVypE4DO4z+JiRUgPypmvy8GVDSRXkBW8fvTRq57ltHCI66C icLg== X-Gm-Message-State: AODbwcCmi199JLfFnEd1rSDQ0WYqYqbL3CmZPl64DNP3RTqs0Qe25ZF7 +Yxuqy60CFYIrXyO X-Received: by 10.98.159.88 with SMTP id g85mr2739663pfe.21.1496861707877; Wed, 07 Jun 2017 11:55:07 -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.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jun 2017 11:55:07 -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 3/4] net: qrtr: Broadcast DEL_CLIENT message when endpoint is closed Date: Wed, 7 Jun 2017 11:55:00 -0700 Message-Id: <20170607185501.6000-3-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 Per the QMUXv2 protocol specificiation a DEL_CLIENT message should be broadcasted when an endpoint is disconnected. The protocol specification does suggest that the router can keep track of which nodes the endpoint has been communicating with to not wake up sleeping remotes unecessarily, but implementation of this suggestion is left for the future. Cc: Courtney Cavin Signed-off-by: Bjorn Andersson --- net/qrtr/qrtr.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.12.0 diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index e8cbab23d667..d7516098b5aa 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -112,6 +112,7 @@ struct qrtr_node { }; static int qrtr_local_enqueue(struct qrtr_node *node, struct sk_buff *skb); +static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb); /* Release node resources and free the node. * @@ -312,6 +313,26 @@ static struct sk_buff *qrtr_alloc_local_bye(u32 src_node) return skb; } +static struct sk_buff *qrtr_alloc_del_client(struct sockaddr_qrtr *sq) +{ + const int pkt_len = 20; + struct sk_buff *skb; + __le32 *buf; + + skb = qrtr_alloc_ctrl_packet(QRTR_TYPE_DEL_CLIENT, pkt_len, + sq->sq_node, QRTR_NODE_BCAST); + if (!skb) + return NULL; + + buf = (__le32 *)skb_put(skb, pkt_len); + memset(buf, 0, pkt_len); + buf[0] = cpu_to_le32(QRTR_TYPE_DEL_CLIENT); + buf[1] = cpu_to_le32(sq->sq_node); + buf[2] = cpu_to_le32(sq->sq_port); + + return skb; +} + static struct qrtr_sock *qrtr_port_lookup(int port); static void qrtr_port_put(struct qrtr_sock *ipc); @@ -448,8 +469,15 @@ static void qrtr_port_put(struct qrtr_sock *ipc) /* Remove port assignment. */ static void qrtr_port_remove(struct qrtr_sock *ipc) { + struct sk_buff *skb; int port = ipc->us.sq_port; + skb = qrtr_alloc_del_client(&ipc->us); + if (skb) { + skb_set_owner_w(skb, &ipc->sk); + qrtr_bcast_enqueue(NULL, skb); + } + if (port == QRTR_PORT_CTRL) port = 0;