netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Jassi Brar <jassisinghbrar@gmail.com>,
	Adam Young <admiyo@amperemail.onmicrosoft.com>
Cc: Adam Young <admiyo@os.amperecomputing.com>,
	netdev@vger.kernel.org, Sudeep Holla <sudeep.holla@arm.com>,
	linux-kernel@vger.kernel.org,
	Jeremy Kerr <jk@codeconstruct.com.au>,
	Matt Johnston <matt@codeconstruct.com.au>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Huisong Li <lihuisong@huawei.com>
Subject: Re: [PATCH net-next v29 1/3] mailbox: add callback function for rx buffer allocation
Date: Mon, 6 Oct 2025 09:54:15 +0100	[thread overview]
Message-ID: <aOODt2lj--GOZkhU@bogus> (raw)
In-Reply-To: <CABb+yY3T6LdPoGysNAyNr_EgCAcq2Vxz3V1ReDgF_fGYcqRrbw@mail.gmail.com>

On Sun, Oct 05, 2025 at 06:34:51PM -0500, Jassi Brar wrote:
> On Sun, Oct 5, 2025 at 12:13 AM Adam Young
> <admiyo@amperemail.onmicrosoft.com> wrote:
> >
> > Jassi, this one needs your attention specifically.
> >
> > Do you have an issue with adding this callback?  I think it will add an
> > important ability to the receive path for the mailbox API: letting the
> > client driver specify how to allocate the memory that the message is
> > coming in.  For general purpose mechanisms like PCC, this is essential:
> > the mailbox cannot know all of the different formats that the drivers
> > are going to require.  For example, the same system might have MPAM
> > (Memory Protection) and MCTP (Network Protocol) driven by the same PCC
> > Mailbox.
> >
> Looking at the existing code, I am not even sure if rx_alloc() is needed at all.
> 
> Let me explain...
> 1) write_response, via rx_alloc, is basically asking the client to
> allocate a buffer of length parsed from the pcc header in shmem.
> 2) write_response is called from isr and even before the
> mbox_chan_received_data() call.
> 
> Why can't you get rid of write_response() and simply call
>     mbox_chan_received_data(chan, pchan->chan.shmem)
> for the client to allocate and memcpy_fromio itself?
> Ideally, the client should have the buffer pre-allocated and only have
> to copy the data into it, but even if not it will still not be worse
> than what you currently have.
> 

Exactly, this is what I have been telling.

Adam,

Please share the code that you have attempted with this approach and the
problems you have faced.

-- 
Regards,
Sudeep

  reply	other threads:[~2025-10-06  8:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25 19:00 [PATCH net-next v29 0/3] MCTP Over PCC Transport Adam Young
2025-09-25 19:00 ` [PATCH net-next v29 1/3] mailbox: add callback function for rx buffer allocation Adam Young
2025-09-26 14:13   ` Simon Horman
2025-09-26 15:44   ` Sudeep Holla
2025-10-05  5:13   ` Adam Young
2025-10-05 23:34     ` Jassi Brar
2025-10-06  8:54       ` Sudeep Holla [this message]
2025-10-06 15:24       ` Adam Young
2025-10-06 15:48         ` Sudeep Holla
2025-09-25 19:00 ` [PATCH net-next v29 2/3] mailbox/pcc: use mailbox-api level rx_alloc callback Adam Young
2025-09-25 19:00 ` [PATCH net-next v29 3/3] mctp pcc: Implement MCTP over PCC Transport Adam Young
2025-09-26 14:16   ` Simon Horman
2025-09-26 16:06   ` [External] : " ALOK TIWARI

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=aOODt2lj--GOZkhU@bogus \
    --to=sudeep.holla@arm.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=admiyo@amperemail.onmicrosoft.com \
    --cc=admiyo@os.amperecomputing.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=jk@codeconstruct.com.au \
    --cc=kuba@kernel.org \
    --cc=lihuisong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).