Skip to content

Commit

Permalink
Merge pull request #12 from ifplusor/fix-cq-entries
Browse files Browse the repository at this point in the history
fix: the entries field of cq is not set
  • Loading branch information
Iceber authored Jun 9, 2022
2 parents dce5d2f + ca187d3 commit 30825ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions mmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func mmapCQ(iour *IOURing) (err error) {
cq.head = (*uint32)(unsafe.Pointer(cq.ptr + uintptr(params.CQOffset.Head)))
cq.tail = (*uint32)(unsafe.Pointer(cq.ptr + uintptr(params.CQOffset.Tail)))
cq.mask = (*uint32)(unsafe.Pointer(cq.ptr + uintptr(params.CQOffset.RingMask)))
cq.entries = (*uint32)(unsafe.Pointer(cq.ptr + uintptr(params.CQOffset.RingEntries)))
cq.flags = (*uint32)(unsafe.Pointer(cq.ptr + uintptr(params.CQOffset.Flags)))
cq.overflow = (*uint32)(unsafe.Pointer(cq.ptr + uintptr(params.CQOffset.Overflow)))

Expand Down
18 changes: 9 additions & 9 deletions syscall/io_uring_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ type SubmissionQueueRingOffset struct {

// CompletionQueueRingOffset describes the offsets of various ring buffer fields
type CompletionQueueRingOffset struct {
Head uint32
Tail uint32
RingMask uint32
Entries uint32
Overflow uint32
Cqes uint32
Flags uint32
Resv1 uint32
Resv2 uint64
Head uint32
Tail uint32
RingMask uint32
RingEntries uint32
Overflow uint32
Cqes uint32
Flags uint32
Resv1 uint32
Resv2 uint64
}

func IOURingSetup(entries uint, params *IOURingParams) (int, error) {
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ type CompletionQueue struct {
head *uint32
tail *uint32
mask *uint32
overflow *uint32
entries *uint32
flags *uint32
overflow *uint32

cqes []iouring_syscall.CompletionQueueEvent
}
Expand Down

0 comments on commit 30825ba

Please sign in to comment.