Re: af_xdp_user.c limits

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

 



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.



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux