Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1400293imp; Fri, 22 Feb 2019 02:45:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IZFCFWC9Q2ajUT9k77xiH+VVJJafkFobndb2FUwyLinb4r+jwYBp6sF9L65alwFX8g2u5sz X-Received: by 2002:a17:902:765:: with SMTP id 92mr2350868pli.95.1550832333347; Fri, 22 Feb 2019 02:45:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550832333; cv=none; d=google.com; s=arc-20160816; b=cBvXHVOaM1t6RjW6AQz027gzlwFuKHUgYIls9EDAwENDHD//ciABxqot4OsgHrzA/l KuyBNiH9papZSjOB7ucnsIw8OPtbG9sHBK5pJn1WLwWBNfrSwTjdz77qtl8bSDYyq2f5 w/JWWXf1mklBtmpgmhlcjx77wNFKUji03F6RY7GEX68nJpvf3M5rXQRV1ZVabm+WKwGe nk61fJ4h26TU5GJF0gafBcHYzufxxRSriC1ZT+k8XKN6ojTRsjLlqo9/kRRuRPGL4aZ5 sl/CHbTt3cEHQY7I3iUL5dLvEMSyZHF170IH5Xgx9ELr91QhfXOW76sMGb8ToyEphduc suIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=uTLDITEqEzsdpv/ZF46Bp8aG7gOIIFw5IlVGn2fRAd8=; b=ql2oeNU8F3J2HecUiL1EnUm33QKtgFe++KD5n1STlfdyWgcQ/2NYCQ/L0Eeu3p08+p tQ2of+pLtRXgnvzVmun+95rXIkubvBAiMhMM+9ATAAtDGAFWDsg9h6hPqYfuSMCUOkR5 xSlY0fAdXOcaCFVOynhjHI4WwROYcmgg1ffVvtPYetNS99yANXyvCabMBcCtTE7goe9v jtyzTMkf/nZkjPiJRpJpoh731yh8f/JuU2ioG4d6a+y4Z08KZ8nJcGnGNB9lvBayGGO+ 0Cmy1Hzwu3K2EpV6xmcLYhDwIBW7KwVMRv9iVI4q+8j/FqPdV+K0Jf/C7MgX6lRPN7pA 6v7w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si1122101plb.146.2019.02.22.02.45.17; Fri, 22 Feb 2019 02:45:33 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbfBVKo4 (ORCPT + 99 others); Fri, 22 Feb 2019 05:44:56 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:35615 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726135AbfBVKoz (ORCPT ); Fri, 22 Feb 2019 05:44:55 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1MAaT5M011839; Fri, 22 Feb 2019 11:44:50 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2qpc75j5n5-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 22 Feb 2019 11:44:50 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A4B1031; Fri, 22 Feb 2019 10:44:49 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 768D32C54; Fri, 22 Feb 2019 10:44:49 +0000 (GMT) Received: from [10.201.23.162] (10.75.127.51) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 22 Feb 2019 11:44:48 +0100 Subject: Re: [PATCH] rpmsg: virtio_rpmsg_bus: acknowledge the received creation message To: Xiang Xiao , , , , , , CC: QianWenfa , Xiang Xiao References: <1549955596-19784-1-git-send-email-xiaoxiang@xiaomi.com> From: Arnaud Pouliquen Openpgp: preference=signencrypt Autocrypt: addr=arnaud.pouliquen@st.com; prefer-encrypt=mutual; keydata= xsFNBFZu+HIBEAC/bt4pnj18oKkUw40q1IXSPeDFOuuznWgFbjFS6Mrb8axwtnxeYicv0WAL rWhlhQ6W2TfKDJtkDygkfaZw7Nlsj57zXrzjVXuy4Vkezxtg7kvSLYItQAE8YFSOrBTL58Yd d5cAFz/9WbWGRf0o9MxFavvGQ9zkfHVd+Ytw6dJNP4DUys9260BoxKZZMaevxobh5Hnram6M gVBYGMuJf5tmkXD/FhxjWEZ5q8pCfqZTlN9IZn7S8d0tyFL7+nkeYldA2DdVplfXXieEEURQ aBjcZ7ZTrzu1X/1RrH1tIQE7dclxk5pr2xY8osNePmxSoi+4DJzpZeQ32U4wAyZ8Hs0i50rS VxZuT2xW7tlNcw147w+kR9+xugXrECo0v1uX7/ysgFnZ/YasN8E+osM2sfa7OYUloVX5KeUK yT58KAVkjUfo0OdtSmGkEkILWQLACFEFVJPz7/I8PisoqzLS4Jb8aXbrwgIg7d4NDgW2FddV X9jd1odJK5N68SZqRF+I8ndttRGK0o7NZHH4hxJg9jvyEELdgQAmjR9Vf0eZGNfowLCnVcLq s+8q3nQ1RrW5cRBgB8YT2kC8wwY5as8fhfp4846pe2b8Akh0+Vba5pXaTvtmdOMRrcS7CtF6 Ogf9zKAxPZxT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MOzahCEZ7UUwD5LKxRfmBWBgK 36tfTyducLyZtGB3mbJYfWeI7aiFgYsd5ehov6OIBlOz5iOshd97+wbbmziYEp6jWMIMX+Em zqSvS5ETZydayO5JBbw7fFBd1nGVYk1WL6Ll72g+iEnqgIckMtxey1TgfT7GhPkR7hl54ZAe 8mOik8I/F6EW8XyQAA2P Message-ID: <5cf04a05-938a-2dd0-d36b-e939f0c935ff@st.com> Date: Fri, 22 Feb 2019 11:44:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1549955596-19784-1-git-send-email-xiaoxiang@xiaomi.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-22_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Xiang, On 2/12/19 8:13 AM, Xiang Xiao wrote: > From: QianWenfa > > the two phase handsake make the client could initiate the transfer > immediately without the server side send any dummy message first. As discussed on OpenAMP mailing list, the first point (from my pov) is to figure out if this should be part of the rpmsg protocol or service dependent (so managed by the rpmsg client itself)... > > Signed-off-by: Wenfa Qian > Signed-off-by: Xiang Xiao > --- > drivers/rpmsg/virtio_rpmsg_bus.c | 25 ++++++++++++++++++++----- > 1 file changed, 20 insertions(+), 5 deletions(-) > > diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c > index 664f957..e323c98 100644 > --- a/drivers/rpmsg/virtio_rpmsg_bus.c > +++ b/drivers/rpmsg/virtio_rpmsg_bus.c > @@ -71,6 +71,7 @@ struct virtproc_info { > > /* The feature bitmap for virtio rpmsg */ > #define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ > +#define VIRTIO_RPMSG_F_ACK 1 /* RP supports name service acknowledge */ > > /** > * struct rpmsg_hdr - common header for all rpmsg messages > @@ -115,10 +116,12 @@ struct rpmsg_ns_msg { > * > * @RPMSG_NS_CREATE: a new remote service was just created > * @RPMSG_NS_DESTROY: a known remote service was just destroyed > + * @RPMSG_NS_ACK: acknowledge the previous creation message > */ > enum rpmsg_ns_flags { > RPMSG_NS_CREATE = 0, > RPMSG_NS_DESTROY = 1, > + RPMSG_NS_ACK = 2, > }; > > /** > @@ -330,13 +333,14 @@ static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev) > int err = 0; > > /* need to tell remote processor's name service about this channel ? */ > - if (rpdev->announce && rpdev->ept && > + if (rpdev->ept && (rpdev->announce || > + virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_ACK)) && > virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {Regarding this condition i have a concern. If rpdev->announce is false but VIRTIO_RPMSG_F_ACK feature is set, this should generate an ack message. Seems that this condition can occurs depending on the rpmsg_device struct provided on registration, when rpmsg_dev_probe is called. > struct rpmsg_ns_msg nsm; > > strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE); > nsm.addr = rpdev->ept->addr; > - nsm.flags = RPMSG_NS_CREATE; > + nsm.flags = rpdev->announce ? RPMSG_NS_CREATE : RPMSG_NS_ACK; > > err = rpmsg_sendto(rpdev->ept, &nsm, sizeof(nsm), RPMSG_NS_ADDR); > if (err) > @@ -820,6 +824,7 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, > struct rpmsg_channel_info chinfo; > struct virtproc_info *vrp = priv; > struct device *dev = &vrp->vdev->dev; > + struct device *tmp; > int ret; > > #if defined(CONFIG_DYNAMIC_DEBUG) > @@ -847,21 +852,30 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, > msg->name[RPMSG_NAME_SIZE - 1] = '\0'; > > dev_info(dev, "%sing channel %s addr 0x%x\n", > - msg->flags & RPMSG_NS_DESTROY ? "destroy" : "creat", > + msg->flags == RPMSG_NS_ACK ? "ack" : > + msg->flags == RPMSG_NS_DESTROY ? "destroy" : "creat", > msg->name, msg->addr); > > strncpy(chinfo.name, msg->name, sizeof(chinfo.name)); > chinfo.src = RPMSG_ADDR_ANY; > chinfo.dst = msg->addr; > > - if (msg->flags & RPMSG_NS_DESTROY) { > + if (msg->flags == RPMSG_NS_DESTROY) { > ret = rpmsg_unregister_device(&vrp->vdev->dev, &chinfo); > if (ret) > dev_err(dev, "rpmsg_destroy_channel failed: %d\n", ret); > - } else { > + } else if (msg->flags == RPMSG_NS_CREATE) { > newch = rpmsg_create_channel(vrp, &chinfo); > if (!newch) > dev_err(dev, "rpmsg_create_channel failed\n"); > + } else if (msg->flags == RPMSG_NS_ACK) { > + chinfo.dst = RPMSG_ADDR_ANY; > + tmp = rpmsg_find_device(&vrp->vdev->dev, &chinfo); nit-picking... replace &vrp->vdev->dev by dev and change tmp by a more explicit name. > + if (tmp) { > + newch = to_rpmsg_device(tmp); > + newch->dst = msg->addr; > + } else typo: braces Regards, Arnaud > + dev_err(dev, "rpmsg_find_device failed\n"); > } > > return 0; > @@ -1028,6 +1042,7 @@ static struct virtio_device_id id_table[] = { > > static unsigned int features[] = { > VIRTIO_RPMSG_F_NS, > + VIRTIO_RPMSG_F_ACK, > }; > > static struct virtio_driver virtio_ipc_driver = { >