Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp32707ybb; Tue, 7 Apr 2020 16:09:54 -0700 (PDT) X-Google-Smtp-Source: APiQypI4VISK0vJX3IqBlUCCmR/bD7M/RL4yRhiiNBu/WFhONgdi3DxJJWjYzoPlLgcD1xwiKISb X-Received: by 2002:a9d:5191:: with SMTP id y17mr3674299otg.267.1586300994814; Tue, 07 Apr 2020 16:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586300994; cv=none; d=google.com; s=arc-20160816; b=O7XYLpzkXwSIuE81WcWMU2DGoKf4QA4iILJLY0oXOU2OpPn1a3zBrTBOt5W3qn+iwe bBPyxaX1+iSvGTf7a+PlyaXyILIr8Tx9ftNuXQGNQ01XHsHD6TXwR179FZYBL6BW5a6N EV9MgjXUtOUvTpRBELgXkt4XC+8OaRwyrZ9M1xJGu8AXmKy+8PLxrUIPjaPpOFO05AC7 NSAefee5QEKjClyMpobUg5rSyJ40yMxq3FA7/NkrA8Xjyu7iHrWbSm3bL2uTziTAn6YL 6O+Sxx1Q+EqFTfxZZwMVRbvO9AgqvfXq7BkVWhW/bKG4HB+lia+LqlrQWhjS8qARgZgw st9A== 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:from:references:cc:to:subject:dkim-signature; bh=6WKZgInaT9hjUwbTam8NpZ66/XTRdie92DX6qrCz+Uk=; b=tu1ZSVqfMKX/VnRlXMbjrsQGPbgWKBZiTbV6YVYYhj4jf3okkOLB3uOKA/8bqoTG5B LfA3q8Hvgl6iLVsYEFx+JYIQxamQRPxU7QC4zwapb8IT/JV/0vOZ0+laX+B8tPGVK6d4 NyqWbLKSOSl584RRkqksFOpX5PZxH6GE/ggr3kq0IbE6ncmfu6YEHGfSz76T2GW7MemO YQElAEslBJbDudfSvk/9R0+X9KHZplBbri9b5wbVLXanqA1K6cSKWv5ecbMfn+uFByEk 2EJ9sTQ1/c0hsa/MDhiHtNxZ5T0lvWbzGbXXpsHLFz4Rp9gDpXDtcCkg9rvJFyg1rabQ 7lCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cIPb3Ap3; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r67si1229944oib.237.2020.04.07.16.09.37; Tue, 07 Apr 2020 16:09:54 -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=@ti.com header.s=ti-com-17Q1 header.b=cIPb3Ap3; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726428AbgDGXHQ (ORCPT + 99 others); Tue, 7 Apr 2020 19:07:16 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:47582 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbgDGXHQ (ORCPT ); Tue, 7 Apr 2020 19:07:16 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 037N7C3c114713; Tue, 7 Apr 2020 18:07:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1586300832; bh=6WKZgInaT9hjUwbTam8NpZ66/XTRdie92DX6qrCz+Uk=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=cIPb3Ap3sGSTSqZPdSvuArxAfXrssWPHSgwQzJ5KtrBKi6hIvZQlQMlBttniN8hUI 2MwdZveunG5NkyUBmtCrjxD64pTKnrs+yNgY9eQeBBzf5/rfPme+jA+Tt9ekh3/jNF 1or4q235qln9sShyQUcvYxbszkUgnqOvVg33e+kI= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 037N7Ct2066448 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Apr 2020 18:07:12 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 7 Apr 2020 18:07:12 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 7 Apr 2020 18:07:11 -0500 Received: from [10.250.86.212] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 037N7Bhh098908; Tue, 7 Apr 2020 18:07:11 -0500 Subject: Re: [PATCH v2] rpmsg: core: Add wildcard match for name service To: Mathieu Poirier , Arnaud POULIQUEN CC: Ohad Ben-Cohen , Bjorn Andersson , linux-remoteproc , Linux Kernel Mailing List References: <20200310155058.1607-1-mathieu.poirier@linaro.org> <591bd727-32af-9ea2-8c46-98f46ee3711e@ti.com> <34d1277f-c35e-5df8-7d0c-ea1e961a127f@st.com> <20200327193602.GA22939@xps15> From: Suman Anna Message-ID: <77cba22f-5911-e88a-ec25-50cbe9b8fbbe@ti.com> Date: Tue, 7 Apr 2020 18:07:11 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20200327193602.GA22939@xps15> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, Arnaud, On 3/27/20 2:36 PM, Mathieu Poirier wrote: > On Fri, Mar 27, 2020 at 10:35:34AM +0100, Arnaud POULIQUEN wrote: >> Hi >> >> On 3/26/20 11:01 PM, Mathieu Poirier wrote: >>> On Thu, 26 Mar 2020 at 14:42, Suman Anna wrote: >>>> >>>> On 3/26/20 3:21 PM, Mathieu Poirier wrote: >>>>> On Thu, 26 Mar 2020 at 09:06, Suman Anna wrote: >>>>>> >>>>>> Hi Mathieu, >>>>>> >>>>>> On 3/10/20 10:50 AM, Mathieu Poirier wrote: >>>>>>> Adding the capability to supplement the base definition published >>>>>>> by an rpmsg_driver with a postfix description so that it is possible >>>>>>> for several entity to use the same service. >>>>>>> >>>>>>> Signed-off-by: Mathieu Poirier >>>>>>> Acked-by: Arnaud Pouliquen >>>>>> >>>>>> So, the concern I have here is that we are retrofitting this into the >>>>>> existing 32-byte name field, and the question is if it is going to be >>>>>> enough in general. That's the reason I went with the additional 32-byte >>>>>> field with the "rpmsg: add a description field" patch. >>>>>> >>>>> >>>>> That's a valid concern. >>>>> >>>>> Did you consider increasing the size of RPMSG_NAME_SIZE to 64? Have >>>>> you found cases where that wouldn't work? I did a survey of all the >>>>> places the #define is used and all destination buffers are also using >>>>> the same #define in their definition. It would also be backward >>>>> compatible with firmware implementations that use 32 byte. >>>> >>>> You can't directly bump the size without breaking the compatibility on >>>> the existing rpmsg_ns_msg in firmwares right? All the Linux-side drivers >>>> will be ok since they use the same macro but rpmsg_ns_msg has presence >>>> on both kernel and firmware-sides. >>> >>> Ah yes yes... The amount of bytes coming out of the pipe won't match. >>> Let me think a little... >> >> +1 for Suman's concern. >> >> Anyway i would like to challenge the need of more than 32 bytes to >> differentiate service instances. >> "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", seems to me enough if we only need >> to differentiate the instances. Remember that the rpmsg_device_id name takes some space within here. So, the shorter the rpmsg_device_id table name, the more room you have. >> >> But perhaps the need is also to provide a short description of the service? I am mostly using it to provide a unique instantiation name. In anycase, I have cross-checked against my current firmwares, and so far all of them happen to have the name + desc < 31 bytes. >> >> Suman, could you share some examples of your need? > > Looking at things further it is possible to extend the name of the service to > 64 byte while keeping backward compatibility by looking up the size of @len > in function rpmsg_ns_cb(). From there work with an rpmsg_ns_msg or a new > rpmsg_ns_msg64, pretty much the way you did in your patch[1]. In fact the > approach is the same except you are using 2 arrays of 32 byte and I'm using one > of 64. > > As Arnaud mentioned, is there an immediate need to support a 64-byte name? If > not than I suggest to move forward with this patch and address the issue when we > get there - at least we know there is room for extention. Otherwise I'll spin > off another revision but it will be bigger and more complex. Yeah ok. I have managed to get my downstream drivers that use the desc field working with this patch after modifying the firmwares to publish using combined name, and adding logic in probe to get the trailing portion of the name. So, the only thing that is missing or content for another patch is if we need to add some tooling/helper stuff for giving the trailing stuff to rpmsg drivers? regards Suman > > Thanks, > Mathieu > > [1]. https://patchwork.kernel.org/patch/11096599/ > >>>>>> >>>>>>> --- >>>>>>> Changes for V2: >>>>>>> - Added Arnaud's Acked-by. >>>>>>> - Rebased to latest rproc-next. >>>>>>> >>>>>>> drivers/rpmsg/rpmsg_core.c | 20 +++++++++++++++++++- >>>>>>> 1 file changed, 19 insertions(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c >>>>>>> index e330ec4dfc33..bfd25978fa35 100644 >>>>>>> --- a/drivers/rpmsg/rpmsg_core.c >>>>>>> +++ b/drivers/rpmsg/rpmsg_core.c >>>>>>> @@ -399,7 +399,25 @@ ATTRIBUTE_GROUPS(rpmsg_dev); >>>>>>> static inline int rpmsg_id_match(const struct rpmsg_device *rpdev, >>>>>>> const struct rpmsg_device_id *id) >>>>>>> { >>>>>>> - return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0; >>>>>>> + size_t len = min_t(size_t, strlen(id->name), RPMSG_NAME_SIZE); >>>>>>> + >>>>>>> + /* >>>>>>> + * Allow for wildcard matches. For example if rpmsg_driver::id_table >>>>>>> + * is: >>>>>>> + * >>>>>>> + * static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = { >>>>>>> + * { .name = "rpmsg-client-sample" }, >>>>>>> + * { }, >>>>>>> + * } >>>>>>> + * >>>>>>> + * Then it is possible to support "rpmsg-client-sample*", i.e: >>>>>>> + * rpmsg-client-sample >>>>>>> + * rpmsg-client-sample_instance0 >>>>>>> + * rpmsg-client-sample_instance1 >>>>>>> + * ... >>>>>>> + * rpmsg-client-sample_instanceX >>>>>>> + */ >>>>>>> + return strncmp(id->name, rpdev->id.name, len) == 0; >>>>>>> } >>>>>>> >>>>>>> /* match rpmsg channel and rpmsg driver */ >>>>>>> >>>>>> >>>>