Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packet buffer size restrictions #248

Open
equivalence1 opened this issue Oct 21, 2024 · 3 comments
Open

packet buffer size restrictions #248

equivalence1 opened this issue Oct 21, 2024 · 3 comments

Comments

@equivalence1
Copy link

equivalence1 commented Oct 21, 2024

Hello,

I'm sending (only need TX from ef_vi) really small packets using ef_vi (say 100 bytes). From the examples and docs it's not really clear whether I must allocate 2KB packet buffers for them in DMA mode, or can I use smaller ones. In PIO, as far as I could understand, there is no notion of packet buffer for transmissions, and the only restriction is that the packet is 64-bytes aligned. 2KB buffers seems too wasteful and also I'm worried that this packets gonna be evicted from cache, which will impact performance of CTPIO transmissions, since it also requires DMA fallback.

@rhughes-xilinx
Copy link

tx doesn't really have a concept of packet buffers: all it has is pointers to the start of the packet and the length. Given that, it's clear that you can invent all sorts of arbitrary allocation strategies for your packet data. Since a given txq will always complete requests in FIFO order, a ring is simple and easy.

The mapping from app virtual address space to I/O space is arbitrary at page granularity. Hardware does support 'gather' transmits, and 'pages' can be large, but if you're only sending small packets then it's much easier if I just tell you never to cross a 4KB boundary with a single send. It's not the complete truth, but it is the minimal truth

@equivalence1
Copy link
Author

@rhughes-xilinx

Thanks for clarification! It's just lines like this one

const int BUF_SIZE = 2048; /* Hardware always wants 2k buffers */

const int BUF_SIZE = 2048;  /* Hardware always wants 2k buffers */

Confused me.

I tried using CTPIO with DMA buffers of size 128 bytes in it indeed worked. Thanks!

@rhughes-xilinx
Copy link

That documentation will be generic, assuming that you're going to be using the NIC for both rx and tx. I guess it also hasn't been updated for a long time: ancient NICs did require 2KB buffers, but on current NICs you can use ef_vi_receive_set_buffer_len()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants