All of lore.kernel.org
 help / color / mirror / Atom feed
* af_xdp_user.c limits
@ 2022-05-31 22:32 Howard Lum
  2022-06-01 12:37 ` Maciej Fijalkowski
  0 siblings, 1 reply; 2+ messages in thread
From: Howard Lum @ 2022-05-31 22:32 UTC (permalink / raw)
  To: xdp-newbies

I have some questions regarding the limits in
https://github.com/xdp-project/xdp-tutorial/blob/master/advanced03-AF_XDP/af_xdp_user.c

NUM_FRAMES is hard-coded to 4096. Can I change NUM_FRAMES to 65536 to buffer a large number of packets?

FRAME_SIZE is hard-coded to XSK_UMEM__DEFAULT_FRAME_SIZE which is 4096 bytes in my setup. Can I just change FRAME_SIZE to 2048 to save memory?

XSK_RING_CONS__DEFAULT_NUM_DESCS is used to set the rx ring size to 2048. I have a NIC that can handle 8192 packets. Should I adjust the rx ring size to match?

XSK_RING_PROD__DEFAULT_NUM_DESCS is used to set the tx ring size to 2048. Similarly, should I adjust the tx ring size to match the NIC?

Howard


This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately and delete this message and any attachment from your system. Do not copy them or disclose the contents to any other person.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: af_xdp_user.c limits
  2022-05-31 22:32 af_xdp_user.c limits Howard Lum
@ 2022-06-01 12:37 ` Maciej Fijalkowski
  0 siblings, 0 replies; 2+ messages in thread
From: Maciej Fijalkowski @ 2022-06-01 12:37 UTC (permalink / raw)
  To: Howard Lum; +Cc: xdp-newbies

On Tue, May 31, 2022 at 10:32:57PM +0000, Howard Lum wrote:
> I have some questions regarding the limits in
> https://github.com/xdp-project/xdp-tutorial/blob/master/advanced03-AF_XDP/af_xdp_user.c
> 
> NUM_FRAMES is hard-coded to 4096. Can I change NUM_FRAMES to 65536 to buffer a large number of packets?

I think that you can, as long as mmap() call succeeds that is supposed to
map the umem memory between user and kernel space.

> 
> FRAME_SIZE is hard-coded to XSK_UMEM__DEFAULT_FRAME_SIZE which is 4096 bytes in my setup. Can I just change FRAME_SIZE to 2048 to save memory?

For aligned mode, both 2k and 4k frames are supported. You can also use
unaligned mode, but that requires huge pages under the hood.

> 
> XSK_RING_CONS__DEFAULT_NUM_DESCS is used to set the rx ring size to 2048. I have a NIC that can handle 8192 packets. Should I adjust the rx ring size to match?
> 
> XSK_RING_PROD__DEFAULT_NUM_DESCS is used to set the tx ring size to 2048. Similarly, should I adjust the tx ring size to match the NIC?

Only thing we suggest is to keep the fill queue length >= HW Rx + XSK Rx
lengths. See:
https://elixir.bootlin.com/linux/latest/source/samples/bpf/xdpsock_user.c#L955

Besides that, XSK ring lenghts don't have to match HW ring lenghts. Up to
your setup and environment.

> 
> Howard
> 
> 
> This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately and delete this message and any attachment from your system. Do not copy them or disclose the contents to any other person.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-01 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 22:32 af_xdp_user.c limits Howard Lum
2022-06-01 12:37 ` Maciej Fijalkowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.