Linux-remoteproc Archive on lore.kernel.org
 help / color / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH 9/9] rpmsg: ns: name service announcement endianness
Date: Mon, 24 Aug 2020 17:04:57 -0600
Message-ID: <20200824230457.GF3938186@xps15> (raw)
In-Reply-To: <20200731114732.12815-10-arnaud.pouliquen@st.com>

On Fri, Jul 31, 2020 at 01:47:32PM +0200, Arnaud Pouliquen wrote:
> The endianness has to be fixed to ensure that both sides can
> decode the message. The Little endian format is used according
> to the generic virtio implementation.
> 
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> ---
>  drivers/rpmsg/rpmsg_ns.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/rpmsg/rpmsg_ns.c b/drivers/rpmsg/rpmsg_ns.c
> index cc2bd47c415a..b478e2b55213 100644
> --- a/drivers/rpmsg/rpmsg_ns.c
> +++ b/drivers/rpmsg/rpmsg_ns.c
> @@ -33,8 +33,8 @@ enum rpmsg_ns_flags {
>   */
>  struct rpmsg_ns_msg {
>  	char name[RPMSG_NAME_SIZE];
> -	u32 addr;
> -	u32 flags;
> +	__le32 addr;
> +	__le32 flags;
>  } __packed;
>  
>  /**
> @@ -57,8 +57,8 @@ static int rpmsg_ns_channel_announce(struct rpmsg_device *rpdev, int ns_flag)
>  		return -EINVAL;
>  
>  	strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE);
> -	nsm.addr = rpdev->ept->addr;
> -	nsm.flags = ns_flag;
> +	nsm.addr = cpu_to_le32(rpdev->ept->addr);
> +	nsm.flags = cpu_to_le32(ns_flag);
>  
>  	return rpmsg_send_offchannel(rpdev->ept, RPMSG_NS_ADDR, RPMSG_NS_ADDR,
>  				     &nsm, sizeof(nsm));
> @@ -84,6 +84,7 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len,
>  	struct rpmsg_device *newch;
>  	struct rpmsg_channel_info chinfo;
>  	struct device *dev = &rpdev->dev;
> +	unsigned int flags = le32_to_cpu(msg->flags);
>  	int ret;
>  
>  #if defined(CONFIG_DYNAMIC_DEBUG)
> @@ -101,13 +102,13 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len,
>  
>  	strncpy(chinfo.name, msg->name, sizeof(chinfo.name));
>  	chinfo.src = RPMSG_ADDR_ANY;
> -	chinfo.dst = msg->addr;
> +	chinfo.dst = le32_to_cpu(msg->addr);
>  
>  	dev_info(dev, "%sing channel %s addr 0x%x\n",
> -		 msg->flags & RPMSG_NS_DESTROY ? "destroy" : "creat",
> -		 msg->name, msg->addr);
> +		 flags & RPMSG_NS_DESTROY ? "destroy" : "creat",
> +		 msg->name, chinfo.dst);
>  
> -	if (msg->flags & RPMSG_NS_DESTROY) {
> +	if (flags & RPMSG_NS_DESTROY) {
>  		ret = rpmsg_release_channel(rpdev, &chinfo);
>  		if (ret)
>  			dev_err(dev, "rpmsg_destroy_channel failed: %d\n", ret);

Please merge this patch to patch 5, I don't see a need for doing this
separately.

Thanks,
Mathieu

> -- 
> 2.17.1
> 

  reply index

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 11:47 [PATCH 0/9] introduce name service announcement rpmsg driver Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 1/9] rpmsg: virtio: rename rpmsg_create_channel Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 2/9] rpmsg: core: add channel creation internal API Arnaud Pouliquen
2020-08-24 22:44   ` Mathieu Poirier
2020-07-31 11:47 ` [PATCH 3/9] rpmsg: virtio: add rpmsg channel device ops Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 4/9] rpmsg: define the name service announcement as reserved address Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 5/9] rpmsg: introduce reserved rpmsg driver for ns announcement Arnaud Pouliquen
2020-08-05  9:05   ` kernel test robot
2020-08-24 22:47   ` Mathieu Poirier
2020-08-25 11:57     ` Arnaud POULIQUEN
2020-08-25 14:36       ` Mathieu Poirier
2020-07-31 11:47 ` [PATCH 6/9] rpmsg: virtio: use rpmsg ns device for the " Arnaud Pouliquen
2020-08-24 22:48   ` Mathieu Poirier
2020-08-25 12:02     ` Arnaud POULIQUEN
2020-07-31 11:47 ` [PATCH 7/9] rpmsg: ns: add name service announcement service Arnaud Pouliquen
2020-07-31 11:47 ` [PATCH 8/9] rpmsg: virtio: use rpmsg_ns driver to manage ns announcement Arnaud Pouliquen
2020-08-25 16:54   ` Mathieu Poirier
2020-08-26  7:42     ` Arnaud POULIQUEN
2020-08-26 22:10       ` Mathieu Poirier
2020-08-27  7:03         ` Arnaud POULIQUEN
2020-07-31 11:47 ` [PATCH 9/9] rpmsg: ns: name service announcement endianness Arnaud Pouliquen
2020-08-24 23:04   ` Mathieu Poirier [this message]
2020-08-20 22:32 ` [PATCH 0/9] introduce name service announcement rpmsg driver Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200824230457.GF3938186@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=arnaud.pouliquen@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=ohad@wizery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-remoteproc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-remoteproc/0 linux-remoteproc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-remoteproc linux-remoteproc/ https://lore.kernel.org/linux-remoteproc \
		linux-remoteproc@vger.kernel.org
	public-inbox-index linux-remoteproc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-remoteproc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git