xdp icon indicating copy to clipboard operation
xdp copied to clipboard

Q: what is the correct way to use this for RX and TX at the same time?

Open hujun-open opened this issue 3 years ago • 4 comments

Hi, I am trying to figure out a correct way to use this pkg for sending & receiving packets over same AF_XDP socket simultaneously, all the AF_XDP socket example I could find is either TX only or RX only or like a server (e.g. receive a packet first, do sth, then send a packet out in one run); but I want to do sending and receiving at the same time; this package doesn't seem to be routine safe, so I can't put RX and TX into two different go routines, however by having both RX and TX in one routine doesn't seem to provide expected performance, sometime it is even slower than using AF_PACKET socket;

so I wonder what is correct way to do this? is there any example that does this sort of thing?

hujun-open avatar Jun 15 '21 22:06 hujun-open

I created a PR #12 that allows TX and RX of same socket could be in separate go routine; it addressed the above use case with expected performance

hujun-open avatar Jun 17 '21 21:06 hujun-open

Had the same problem myself recently, thanks for submitting a diff to address this!

slavc avatar Jul 05 '21 19:07 slavc

Could you show an example to use it?please.

yvanu avatar Oct 26 '23 03:10 yvanu

Could you show an example to use it?please.

you could take a look some use of it in etherconn, check the xdpSock.send() and xdpSock.recv()

hujun-open avatar Oct 27 '23 02:10 hujun-open