Commit Graph

2749 Commits

Author SHA1 Message Date
Josh Bleecher Snyder ce52a5631b Revert "eliminate prefetch"
this breaks graceful shutdown. details TBD.

This reverts commit a474e79bf8967a573f05d07cee0b1abdbee4608a.
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder e33d6a049b eliminate prefetch
looks like a premature optimization
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder abafdc6292 add TODO 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 934709fd7a refactor out common write code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder ba6c48c9e9 whitespace 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 72e8ab8781 port udp improvements to file 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f355e685ef aesthetic tweaks 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 385851de40 waitCompletion retry on EINTR 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 61cde40000 use syncs, start reworking file 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 0132d52e9a make tests psas 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder ed0f50f924 split into several files
file for file stuff
tun for tun stuff
udp for udp stuff
io_uring for general uring stuff

also make build tags suffice
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder dd94b37ef3 remove completed TODO 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder c7cd8a7bae docs 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 5023b6b0c3 make ipv4/ipv6 code parallel
and thus more clearly correct
weirdly, since it is using unsafe
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 152038cabd simplify, docs 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 8a7b42a557 move code around 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 8478d34cca doc and improve shutdown refcounting 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f329d69fb4 docs 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder a1a2fb9181 more whitespace 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 4847a89ecf spit. not so much polish. 2021-07-13 15:15:16 -07:00
kadmin 58c556ad15 net/uring: add go ntohs
Instead of calling out to C for ntohs, just implement it in Go for effiency.

Signed-off-by: kadmin <julianknodt@gmail.com>
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 334c09ab19 comment more 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 3e6e5a2eee incorporate recvOut into recvReqs 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 6ec3378f7b remove more dead code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 385f86e85f document, cull dead code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 52ccff8835 WIP: clean shutdown for UDP conn
this appears to work, most of the time.
there's lots of documentation work remaining,
thinking through the structure remaining,
testing remaining,
porting to file remaining (if appropriate).
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 2118b821cd remove dead code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 1e3e5fd8e7 overhaul error handling of peek/waitcompletion 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder e0d8dcf3eb refactor 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder c1bc58defc set sin_family (oops) 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 7cb1369b19 remove some TODOs, make ip address extraction equally awful 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f274a0cfab simplify change point
at the cost of some very, very naughty unsafe
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f71ff18c11 convert manual tests into automated tests 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 961a23b9df tewak 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f27a61502d start cleaning up code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder a98ed81f2e ipv6 support, UNTESTED, super hacky 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 275cb37031 comments 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 9559752cb5 fix io_uring tun device reads
Well that's an interesting one!
Apparently if you issue multiple concurrent preadv calls on
a TUN device using io_uring, the TUN device falls over.

Possibly corrupting memory along the way.
Which might be why the kernel hung on shutdown...
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 78dbd02718 make it easy to toggle uring on/off 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 4d58223422 switch file.go to test reads instead of writes 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder b05f305eaf simpler init 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder e337ed2033 stick closer to upstream tun reading code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 0fb656794c make cgo pointer rules happy
well that was a mess
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 283614d5e9 use io_uring for sendmsg
and clean up some dead code and unify some things
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 11036e23a1 disable polling for now
we'll maybe bring it back with a token bucket or something.
and/or do multi-sqe submission.
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 522fa9306e they work with extra junk
thanks, dave
no thanks, kernel devs

write no work
use writev
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 7fd5e31070 tun writes...not working yet (but why not??) 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder a03ee93e21 use polling instead of syscall 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 56ba714e10 smush together two return values from C
avoids a per-packet alloc

i will atone for my sins later

if only C let you return multiple values.
or Go let you pass in a pointer w/o it being on the heap.
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder bb78cf81b6 keep 8 requests in the queue at all times 2021-07-13 15:15:16 -07:00