- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/setup.cfa
r1095ccd r1eb239e4 298 298 if( params_in.poll_complete ) params.flags |= IORING_SETUP_IOPOLL; 299 299 300 __u32 nentries = params_in.num_entries != 0 ? params_in.num_entries : 256; 301 if( !is_pow2(nentries) ) { 302 abort("ERROR: I/O setup 'num_entries' must be a power of 2\n"); 303 } 304 if( params_in.poller_submits && params_in.eager_submits ) { 305 abort("ERROR: I/O setup 'poller_submits' and 'eager_submits' cannot be used together\n"); 306 } 300 uint32_t nentries = params_in.num_entries; 307 301 308 302 int fd = syscall(__NR_io_uring_setup, nentries, ¶ms ); … … 362 356 // Get the pointers from the kernel to fill the structure 363 357 // submit queue 364 sq.head = (volatile __u32*)(((intptr_t)sq.ring_ptr) + params.sq_off.head);365 sq.tail = (volatile __u32*)(((intptr_t)sq.ring_ptr) + params.sq_off.tail);366 sq.mask = ( const __u32*)(((intptr_t)sq.ring_ptr) + params.sq_off.ring_mask);367 sq.num = ( const __u32*)(((intptr_t)sq.ring_ptr) + params.sq_off.ring_entries);368 sq.flags = ( __u32*)(((intptr_t)sq.ring_ptr) + params.sq_off.flags);369 sq.dropped = ( __u32*)(((intptr_t)sq.ring_ptr) + params.sq_off.dropped);370 sq.array = ( __u32*)(((intptr_t)sq.ring_ptr) + params.sq_off.array);358 sq.head = (volatile uint32_t *)(((intptr_t)sq.ring_ptr) + params.sq_off.head); 359 sq.tail = (volatile uint32_t *)(((intptr_t)sq.ring_ptr) + params.sq_off.tail); 360 sq.mask = ( const uint32_t *)(((intptr_t)sq.ring_ptr) + params.sq_off.ring_mask); 361 sq.num = ( const uint32_t *)(((intptr_t)sq.ring_ptr) + params.sq_off.ring_entries); 362 sq.flags = ( uint32_t *)(((intptr_t)sq.ring_ptr) + params.sq_off.flags); 363 sq.dropped = ( uint32_t *)(((intptr_t)sq.ring_ptr) + params.sq_off.dropped); 364 sq.array = ( uint32_t *)(((intptr_t)sq.ring_ptr) + params.sq_off.array); 371 365 sq.prev_head = *sq.head; 372 366 373 367 { 374 const __u32num = *sq.num;368 const uint32_t num = *sq.num; 375 369 for( i; num ) { 376 370 sq.sqes[i].user_data = 0ul64; … … 378 372 } 379 373 380 (sq. submit_lock){};374 (sq.lock){}; 381 375 (sq.release_lock){}; 382 376 … … 388 382 sq.ready[i] = -1ul32; 389 383 } 390 sq.prev_ready = 0;391 384 } 392 385 else { 393 386 sq.ready_cnt = 0; 394 387 sq.ready = 0p; 395 sq.prev_ready = 0;396 388 } 397 389 398 390 // completion queue 399 cq.head = (volatile __u32*)(((intptr_t)cq.ring_ptr) + params.cq_off.head);400 cq.tail = (volatile __u32*)(((intptr_t)cq.ring_ptr) + params.cq_off.tail);401 cq.mask = ( const __u32*)(((intptr_t)cq.ring_ptr) + params.cq_off.ring_mask);402 cq.num = ( const __u32*)(((intptr_t)cq.ring_ptr) + params.cq_off.ring_entries);403 cq.overflow = ( __u32*)(((intptr_t)cq.ring_ptr) + params.cq_off.overflow);404 cq.cqes = (struct io_uring_cqe *)(((intptr_t)cq.ring_ptr) + params.cq_off.cqes);391 cq.head = (volatile uint32_t *)(((intptr_t)cq.ring_ptr) + params.cq_off.head); 392 cq.tail = (volatile uint32_t *)(((intptr_t)cq.ring_ptr) + params.cq_off.tail); 393 cq.mask = ( const uint32_t *)(((intptr_t)cq.ring_ptr) + params.cq_off.ring_mask); 394 cq.num = ( const uint32_t *)(((intptr_t)cq.ring_ptr) + params.cq_off.ring_entries); 395 cq.overflow = ( uint32_t *)(((intptr_t)cq.ring_ptr) + params.cq_off.overflow); 396 cq.cqes = (struct io_uring_cqe *)(((intptr_t)cq.ring_ptr) + params.cq_off.cqes); 405 397 406 398 // some paranoid checks … … 450 442 void __ioctx_register($io_ctx_thread & ctx, struct epoll_event & ev) { 451 443 ev.events = EPOLLIN | EPOLLONESHOT; 452 ev.data.u64 = ( __u64)&ctx;444 ev.data.u64 = (uint64_t)&ctx; 453 445 int ret = epoll_ctl(iopoll.epollfd, EPOLL_CTL_ADD, ctx.ring->fd, &ev); 454 446 if (ret < 0) {
Note:
See TracChangeset
for help on using the changeset viewer.