Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2592234ybg; Fri, 31 Jul 2020 04:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTwEyEw9yYJsHm/cH3ReaS4NBr4tIFfUKS4hmYIZbGbEy4+KBqKhsdj1SmEf927nAZzQPI X-Received: by 2002:a17:906:b815:: with SMTP id dv21mr3577808ejb.517.1596196221416; Fri, 31 Jul 2020 04:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596196221; cv=none; d=google.com; s=arc-20160816; b=dEIbWRM1zhi30b0Yc+KEEAANJohXml09ojj582e3EJl3Anaxrrf8X/UeItnNmDqZ0x FWpLepf3Q9d/WRs0fUMB02HQWfsZqJpHy1CU+h50c0XRcXIYFxBC+xiR1msfmV5m9c3Y LIh/U2G50PJwuu0Nd5n3V/wsyLRFV1MyiQk6o50eihBGpHkgvSMJmnk0t5dY+i/e6CFm O5szccNxgch20WskjY5N2MVvbmf30zce2sE1B6fWQyZgR0Sv8BhIvA7Vucl2Pu2Xlgp9 uJUYxUQjcJOmr/O3aMcO9hfgAGLFgYZ4twT0wyyxTkFiES48Q6BBeZYndldg03AAKi3B njuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Al7/FWHuiKIExSa/T5bbmCEZ2bGtSZGlFAqWKG8rmMA=; b=nGIKWP3BRyVtJuuBknlBCdQbF9/uFyctF+vk+mXuzEw/45vzPoy2UkIYIRImH/pJwV MMGgrPxPeKYrCh42pqqE0LV7U9D5ij/hYgDdOTQ11eed0C2Zr/+veKD/PTxvJWaA+Qu9 GPR6hZ1ZOmkbzbLjY2CaZswvVR5Jl7DmYeXefNLYVMp3gP7ubNY675VmILBzdqljBkui 61yv6YsSpXNUUAZiZzKOTAt1NuVsdFRveum5+Qhe7lchU2letZ1JOwhyVWAdl/HQ0VP2 WyqyJtHUhKkRjTFVSbcscKvErcOcO927r2M4OTAqGJcAh40SbR+pCAdx1uLfMmNW61zC BZbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="HkU9S/+l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si2304602ejd.603.2020.07.31.04.49.59; Fri, 31 Jul 2020 04:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="HkU9S/+l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732852AbgGaLr7 (ORCPT + 99 others); Fri, 31 Jul 2020 07:47:59 -0400 Received: from mx07-00178001.pphosted.com ([185.132.182.106]:7998 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732801AbgGaLrx (ORCPT ); Fri, 31 Jul 2020 07:47:53 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06VBcegX030181; Fri, 31 Jul 2020 13:47:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=Al7/FWHuiKIExSa/T5bbmCEZ2bGtSZGlFAqWKG8rmMA=; b=HkU9S/+lcHz2FLd0drohPVM+U+RBzT3b7ggjqmjvfqFeFOglU0OXbysVBIq2YQSVwjg4 okcYNwpREz+9Oq9vMPDoqN8OBG4gvGQuyMtidTQycxRJld+XCS5bXFY2IekQ3Rg/eieY Yeo/B9j80tHNppPunUZxD0MIee5PFq2Zjuy2y8niAMD5d33xt1KGulTEaxuoA6Qfdc2c +5G3JPIuJb3l3O4sMBkV0GabaenRgTI41ULQq+nh+/bVE8fXQRu5Fw/U23Ne5J9hiYlK DB927EcSsbOPvcJikONeG4TyAGgeKclyTmv2C04MBHWUNrehVSSraThpmv+XF7Faa89b pQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32ga72d9jr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2020 13:47:48 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 88B39100038; Fri, 31 Jul 2020 13:47:48 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7D8DD2A7A83; Fri, 31 Jul 2020 13:47:48 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 31 Jul 2020 13:47:47 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier CC: , , , Subject: [PATCH 7/9] rpmsg: ns: add name service announcement service Date: Fri, 31 Jul 2020 13:47:30 +0200 Message-ID: <20200731114732.12815-8-arnaud.pouliquen@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200731114732.12815-1-arnaud.pouliquen@st.com> References: <20200731114732.12815-1-arnaud.pouliquen@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG5NODE3.st.com (10.75.127.15) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-31_04:2020-07-31,2020-07-31 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the RPMsg driver is in charge of the name service announcement, create an API to send channel creation and destruction to the remote processor. Notice that the source address of the message sent is now RPMSG_NS_ADDR. Legacy implementation was to send the message with source address corresponding to the ept created. RPMSG_NS_ADDR as source address make sense as we want to send a message belonging to the NS announcement service and the created ept address is already in the message payload. Signed-off-by: Arnaud Pouliquen --- drivers/rpmsg/rpmsg_internal.h | 3 +++ drivers/rpmsg/rpmsg_ns.c | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h index 641b48f6bf2a..d1549e5cb607 100644 --- a/drivers/rpmsg/rpmsg_internal.h +++ b/drivers/rpmsg/rpmsg_internal.h @@ -119,4 +119,7 @@ static inline int rpmsg_ns_register_device(struct rpmsg_device *rpdev) return rpmsg_register_device(rpdev); } +int rpmsg_ns_announce_create(struct rpmsg_device *rpdev); +int rpmsg_ns_announce_destroy(struct rpmsg_device *rpdev); + #endif diff --git a/drivers/rpmsg/rpmsg_ns.c b/drivers/rpmsg/rpmsg_ns.c index fe7713e737c2..cc2bd47c415a 100644 --- a/drivers/rpmsg/rpmsg_ns.c +++ b/drivers/rpmsg/rpmsg_ns.c @@ -37,6 +37,45 @@ struct rpmsg_ns_msg { u32 flags; } __packed; +/** + * rpmsg_ns_announce_create() -announce to the remote processor + * the service creation or destruction + * @rpdev: the rpmsg channel + * @ns_flag: related to the @rpmsg_ns_flags enum + * + * This function can be called on a channel creation or destruction to inform + * the remote processor, using the reserved name service anouncement channel. + */ +static int rpmsg_ns_channel_announce(struct rpmsg_device *rpdev, int ns_flag) +{ + struct rpmsg_ns_msg nsm; + + if (!rpdev->announce || !rpdev->ept) + return 0; + + if (ns_flag != RPMSG_NS_CREATE && ns_flag != RPMSG_NS_DESTROY) + return -EINVAL; + + strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE); + nsm.addr = rpdev->ept->addr; + nsm.flags = ns_flag; + + return rpmsg_send_offchannel(rpdev->ept, RPMSG_NS_ADDR, RPMSG_NS_ADDR, + &nsm, sizeof(nsm)); +} + +int rpmsg_ns_announce_create(struct rpmsg_device *rpdev) +{ + return rpmsg_ns_channel_announce(rpdev, RPMSG_NS_CREATE); +} +EXPORT_SYMBOL(rpmsg_ns_announce_create); + +int rpmsg_ns_announce_destroy(struct rpmsg_device *rpdev) +{ + return rpmsg_ns_channel_announce(rpdev, RPMSG_NS_DESTROY); +} +EXPORT_SYMBOL(rpmsg_ns_announce_destroy); + /* invoked when a name service announcement arrives */ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, void *priv, u32 src) -- 2.17.1