From patchwork Wed Jun 7 18:54:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 103308 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2084140qgd; Wed, 7 Jun 2017 11:55:10 -0700 (PDT) X-Received: by 10.98.150.199 with SMTP id s68mr14338181pfk.206.1496861710430; Wed, 07 Jun 2017 11:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496861710; cv=none; d=google.com; s=arc-20160816; b=ySyR7KFasLmPbYJIacoVweA/pOrjxJGiVKVtHg8r8hClbuk7RhGEg66SpUxCq+zbvW St1B6RbCm9zWIEj1BchYr2eNKH3HEZVfHw+fe1RL9nXwKDOGj3G4wYadcfqHYfLsaOO8 eLAhuTb/KI7x+w2YNPX4xjW9cdy8V93CFy/xwoz/61xp8hiEu4uhYslCC3uK1xVm8cw8 o2JDr5c40ONBivp1eGkJ/KIb3DTu9csBb88GmBgsYQi+rsLgIJZMQKqXl9bsDfeU38Zm bhhVGg9C5So3fznp8zXuJYJUVYyMkVLpTDs7xA8KZMnbExEYG1Rrr6X9HguA2hbySQDo uqwg== 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=om9s3L+N5fiGngHo9LJjKb/je5ECXCBPdDzNVHHp5kQ=; b=dyrca2XtJ9vENLFXDZ5l2uMQt9YzHFMSBbaQK4I1j5MfUp7Hml6YkBpfvRmKf5Jjer Tcc/KGYfvSZZ3ql/RYftiorAaJ0ZtBxW2A55JbOowQeuhtiYVJgrynwQ1hBliqyZCpi/ w4Hw+m/12JXuK5FjBEuYZBdKlIpXQho7X+5i4YIL6nH4AXTqUL+r/IdNaiyyE5ggELpB 3sM/SFeMqzXAKMHyYSLOAbPPKco8JUG5rfCDmd5jbLMxoPfLzPhdHeFTC8befjpW2MMh 6DvemawuE4S0p0zbyszZ+2iDwCbLfFF/iDriN8+zku5ksEAGA4CVuglSY1wgAsgeRRdY iZHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 n127si2436833pga.135.2017.06.07.11.55.10; Wed, 07 Jun 2017 11:55:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934AbdFGSzI (ORCPT + 10 others); Wed, 7 Jun 2017 14:55:08 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:36130 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbdFGSzH (ORCPT ); Wed, 7 Jun 2017 14:55:07 -0400 Received: by mail-pf0-f180.google.com with SMTP id x63so8642890pff.3 for ; Wed, 07 Jun 2017 11:55:07 -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=trZPSTIv0LkvQ3VvBzlArdmueRgUpcWdE8yr6CsIiZA=; b=ZpjW0vchhh5VkGg5iTq1lXgZsJeCLVw8jVcWoXpzVpGYbU2j69I54D6ME4Mpmvgp+e wAnVLHrjLJOwkOxvStjQ7GaXLfZjc+27OdhmbHLKeIV+QCGxSjDyrKc0PS5PFKsomvwu A7gLCMV6g8+0NQpvO9NEhzCujYlAjq91Wzw2M= 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=trZPSTIv0LkvQ3VvBzlArdmueRgUpcWdE8yr6CsIiZA=; b=AW4W/hw3/7Y69zwuzpw4IrMQ7kxIRCoQ12hC5XnkdoOVa3wPrSA3NaBjJPhJXvhmmA PFx64OPFoM/0SKg6vE1ArAopCICp/o2NVGGpAJ2jwENQ1ayxLoTr0npuu6ebJ7+BhdV6 QYqJW4PIdEdeHwPQAA4lkiMdY5yi+ZQPlptY9yI91q6/S6fHc3BclQEN38bzICtKDY3c Law3ECmj3FOYV6qfbvsziLJ76JArvSHAiuAT21Sm6vXOLqKfnCJ5a1Z5ZXHdGcT+lMgk uYt6YeWVrjWvHreH1m4flOf89RiLdctc9pJ9h+cwi3l6JF1KKJhPDX/Vr3kqmFZ7UP28 A7EQ== X-Gm-Message-State: AODbwcAee9ceRC9KxnHA385vP9QKqU69U0FMpIuf0+S3Iv3XCDtEGXxy qwNblywFe4gSW/Ak X-Received: by 10.84.229.70 with SMTP id d6mr29410005pln.263.1496861706668; Wed, 07 Jun 2017 11:55:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jun 2017 11:55:06 -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 2/4] net: qrtr: Inject BYE on remote termination Date: Wed, 7 Jun 2017 11:54:59 -0700 Message-Id: <20170607185501.6000-2-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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Per the QMUX protocol specification a terminating node can send a BYE control message to signal that the link is going down, upon receiving this all information about remote services should be discarded and local clients should be notified. In the event that the link was brought down abruptly the router is supposed to act like a BYE message has arrived. As there is no harm in receiving an extra BYE from the remote this patch implements the latter by injecting a BYE when the link to the remote is unregistered. The name service will receive the BYE and can implement the notification to the local clients. Cc: Courtney Cavin Signed-off-by: Bjorn Andersson --- net/qrtr/qrtr.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 86d35ed50da9..e8cbab23d667 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -111,6 +111,8 @@ struct qrtr_node { struct list_head item; }; +static int qrtr_local_enqueue(struct qrtr_node *node, struct sk_buff *skb); + /* Release node resources and free the node. * * Do not call directly, use qrtr_node_release. To be used with @@ -291,6 +293,25 @@ static struct sk_buff *qrtr_alloc_resume_tx(u32 src_node, return skb; } +/* Allocate and construct a BYE message to signal remote termination */ +static struct sk_buff *qrtr_alloc_local_bye(u32 src_node) +{ + const int pkt_len = 20; + struct sk_buff *skb; + __le32 *buf; + + skb = qrtr_alloc_ctrl_packet(QRTR_TYPE_BYE, pkt_len, + src_node, qrtr_local_nid); + if (!skb) + return NULL; + + buf = (__le32 *)skb_put(skb, pkt_len); + memset(buf, 0, pkt_len); + buf[0] = cpu_to_le32(QRTR_TYPE_BYE); + + return skb; +} + static struct qrtr_sock *qrtr_port_lookup(int port); static void qrtr_port_put(struct qrtr_sock *ipc); @@ -382,11 +403,17 @@ EXPORT_SYMBOL_GPL(qrtr_endpoint_register); void qrtr_endpoint_unregister(struct qrtr_endpoint *ep) { struct qrtr_node *node = ep->node; + struct sk_buff *skb; mutex_lock(&node->ep_lock); node->ep = NULL; mutex_unlock(&node->ep_lock); + /* Notify the local controller about the event */ + skb = qrtr_alloc_local_bye(node->nid); + if (skb) + qrtr_local_enqueue(NULL, skb); + qrtr_node_release(node); ep->node = NULL; }