WIP: feat: io_uring for netpoll I/O poller#197
WIP: feat: io_uring for netpoll I/O poller#197Jacob953 wants to merge 67 commits intocloudwego:developfrom
Conversation
uring/sys_enter.go
Outdated
|
|
||
| // If the ring is initialized with IORING_SETUP_CQE32, then this field | ||
| // contains 16-bytes of padding, doubling the size of the CQE. | ||
| BigCQE []uint64 |
There was a problem hiding this comment.
16bytes 应该是 [2]uint64 吧,这样定义怎么初始化呢
uring/sys_enter.go
Outdated
| Len uint32 // buffer size or number of iovecs | ||
| OpcodeFlags uint32 | ||
| UserData uint64 // data to be passed back at completion time | ||
|
|
There was a problem hiding this comment.
以下先 pad [3]uint64 吧,这里 union 先不区分
uring/sys_enter.go
Outdated
| Off uint64 // offset into file | ||
| Addr uint64 // pointer to buffer or iovecs | ||
| Len uint32 // buffer size or number of iovecs | ||
| OpcodeFlags uint32 |
uring/sys_mmap.go
Outdated
| // sysMmap is used to configure the URingSQE and URingCQE, | ||
| // it should only be called after the sysSetUp function has completed successfully. | ||
| func (u *URing) sysMmap(p *ringParams) (err error) { | ||
| size := unsafe.Sizeof(URingCQE{}) |
There was a problem hiding this comment.
sizeof 定义为 global var/const,不用每次都算
uring/sys_mmap.go
Outdated
| } | ||
|
|
||
| // TODO: syscall.MAP_POPULATE unsupport for macox | ||
| data, err := syscall.Mmap(u.fd, 0, int(u.sqRing.ringSize), syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_SHARED) |
There was a problem hiding this comment.
syscall.Mmap/Unmap 封装一下,以后可以修改
There was a problem hiding this comment.
uring 不是 only linux 吗,为什么考虑 macox ? 这里没有 syscall.MAP_POPULATE 不行的
| "syscall" | ||
| "unsafe" | ||
| ) | ||
|
|
There was a problem hiding this comment.
public 这个文件的所有方法,sdk 应该支持直接 syscall
uring/syscall.go
Outdated
| } | ||
|
|
||
| //go:linkname sockaddr syscall.Sockaddr.sockaddr | ||
| func sockaddr(addr syscall.Sockaddr) (unsafe.Pointer, uint32, error) |
uring/uring.go
Outdated
| } | ||
|
|
||
| // IOURing create new io_uring instance with Setup Options | ||
| func IOURing(entries uint32, ops ...setupOp) (r *URing, err error) { |
There was a problem hiding this comment.
入口文件,请把用户能调的放在最前面,私有内容放后面,或者放其他文件里
uring/uring.go
Outdated
| } | ||
|
|
||
| // Init system call numbers | ||
| const ( |
uring/uring_cmplt.go
Outdated
| } | ||
|
|
||
| // GetEventsArg implements URing | ||
| func GetEventsArg(sigMask uintptr, sigMaskSz uint32, ts uintptr) *getEventsArg { |
There was a problem hiding this comment.
global func 别混在这里,如果是 private, 小写放最后;public 就放其他文件归类
| "unsafe" | ||
| ) | ||
|
|
||
| func openPoll() Poll { |
There was a problem hiding this comment.
poll_xxx 这些先删掉吧,这里需要开发注册机制,不通过 type 区分
poll_io_uring.go
Outdated
|
|
||
| package netpoll | ||
|
|
||
| import uring "github.com/cloudwego/netpoll/io_uring" |
poll_io_uring.go
Outdated
| @@ -0,0 +1,45 @@ | |||
| // Copyright 2021 CloudWeGo Authors | |||
There was a problem hiding this comment.
Copyright 2022 CloudWeGo Authors
|
Run |
4d19083 to
cfc5b9a
Compare
|
Jacob953 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Follows #151, tracing at #194. Hold, please ;)