Re: [PATCH 1/1] rpmsg: virtio: Make buffer size and number configurable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 9/28/23 08:38, Divin Raj wrote:
> From: Peter Hoyes <Peter.Hoyes@xxxxxxx>
> 
> Replace the MAX_RPMSG_BUF_SIZE and MAX_RPMSG_NUM_BUFS #define in
> virtio_rpmsg_bus.c with the Kconfig parameters CONFIG_RPMSG_VIRTIO_BUF_SIZE
> and CONFIG_RPMSG_VIRTIO_MAX_NUM_BUFS, allowing user-provided customization.
> 
> Making both the number of buffers and size configurable facilitates aligning
> memory requirements between vdev-buffer and vdev-vrings for client drivers
> that require larger buffer sizes, for example.
> 
> Signed-off-by: Peter Hoyes <Peter.Hoyes@xxxxxxx>
> Signed-off-by: Divin Raj <divin.raj@xxxxxxx>
> ---
>  drivers/rpmsg/Kconfig            | 23 +++++++++++++++++++++++
>  drivers/rpmsg/virtio_rpmsg_bus.c | 27 +++------------------------
>  2 files changed, 26 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
> index d3795860f5c0..677f4a1ac8bb 100644
> --- a/drivers/rpmsg/Kconfig
> +++ b/drivers/rpmsg/Kconfig
> @@ -81,4 +81,27 @@ config RPMSG_VIRTIO
>  	select RPMSG_NS
>  	select VIRTIO
>  
> +config RPMSG_VIRTIO_MAX_BUF_SIZE
> +	int "Virtio RPMSG max buffer size (in bytes)"
> +	default 512

Looks to me like you need to:

(a) use the "range" kconfig keyword (Documentation/kbuild/kconfig-language.rst)
and/or
(b) change the source code (driver) to check that both of these new config
variables' values make sense.

As is (in this patch), I could enter a value of 1 for each of them
and see what happens.

> +	depends on RPMSG_VIRTIO
> +	help
> +	  This option allows you to configure the maximum buffer size (in bytes)
> +	  for Virtio RPMSG communications. The number of buffers will be computed
> +	  based on the number of buffers (CONFIG_RPMSG_VIRTIO_MAX_NUM_BUFS)
> +	  supported by the vring. By default, it supports up to a maximum of 512
> +	  buffers (256 in each direction). Each buffer consists of 16 bytes for the
> +	  message header and the remaining bytes for the payload.The default values

	                                                 payload. The

> +	  will utilize a maximum total space of 256KB for the buffers.
> +
> +config RPMSG_VIRTIO_MAX_NUM_BUFS
> +	int "Virtio RPMSG max buffer count (even number for TX and Rx)"

	                                                    Tx and Rx)"

> +	default 512
> +	depends on RPMSG_VIRTIO
> +	help
> +	  This option allows you to configure the maximum number of buffers used
> +	  for Virtio RPMSG communication. By default, it supports up to a maximum
> +	  of 512 buffers (256 in each direction). Please note that this value
> +	  should be an even number, as it accounts for both transmit (TX) and
> +	  receive (Rx) buffers.
>  endmenu


-- 
~Randy



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux