From: Simon Horman <horms@kernel.org>
To: Adam Young <admiyo@os.amperecomputing.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>,
netdev@vger.kernel.org, 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>,
Sudeep Holla <sudeep.holla@arm.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: Fri, 26 Sep 2025 15:13:29 +0100 [thread overview]
Message-ID: <aNafiYk3_Ma5QQ4Q@horms.kernel.org> (raw)
In-Reply-To: <20250925190027.147405-2-admiyo@os.amperecomputing.com>
On Thu, Sep 25, 2025 at 03:00:24PM -0400, Adam Young wrote:
> Allows the mailbox client to specify how to allocate the memory
> that the mailbox controller uses to send the message to the client.
>
> In the case of a network driver, the message should be allocated as
> a struct sk_buff allocated and managed by the network subsystem. The
> two parameters passed back from the callback represent the sk_buff
> itself and the data section inside the skbuff where the message gets
> written.
>
> For simpler cases where the client kmallocs a buffer or returns
> static memory, both pointers should point to the same value.
>
> Signed-off-by: Adam Young <admiyo@os.amperecomputing.com>
> ---
> include/linux/mailbox_client.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
> index c6eea9afb943..901184d0515e 100644
> --- a/include/linux/mailbox_client.h
> +++ b/include/linux/mailbox_client.h
> @@ -21,6 +21,12 @@ struct mbox_chan;
> * @knows_txdone: If the client could run the TX state machine. Usually
> * if the client receives some ACK packet for transmission.
> * Unused if the controller already has TX_Done/RTR IRQ.
> + * @rx_alloc Optional callback that allows the driver
@rx_alloc:
^^^
Flagged by ./scripts/kernel-doc -none -Wall
> + * to allocate the memory used for receiving
> + * messages. The handle parameter is the value to return
> + * to the client,buffer is the location the mailbox should
> + * write to, and size it the size of the buffer to allocate.
> + * inside the buffer where the mailbox should write the data.
> * @rx_callback: Atomic callback to provide client the data received
> * @tx_prepare: Atomic callback to ask client to prepare the payload
> * before initiating the transmission if required.
> @@ -32,6 +38,7 @@ struct mbox_client {
> unsigned long tx_tout;
> bool knows_txdone;
>
> + void (*rx_alloc)(struct mbox_client *cl, void **handle, void **buffer, int size);
> void (*rx_callback)(struct mbox_client *cl, void *mssg);
> void (*tx_prepare)(struct mbox_client *cl, void *mssg);
> void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2025-09-26 14:13 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 [this message]
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
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=aNafiYk3_Ma5QQ4Q@horms.kernel.org \
--to=horms@kernel.org \
--cc=Jonathan.Cameron@huawei.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 \
--cc=sudeep.holla@arm.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).