MCPcopy Create free account
hub / github.com/Mellanox/libvma / decrease_ring_ref_count

Method decrease_ring_ref_count

src/vma/iomux/epfd_info.cpp:313–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313void epfd_info::decrease_ring_ref_count(ring* ring)
314{
315 m_ring_map_lock.lock();
316 ring_map_t::iterator iter = m_ring_map.find(ring);
317 BULLSEYE_EXCLUDE_BLOCK_START
318 if (iter == m_ring_map.end()) {
319 __log_err("expected to find ring %p here!", ring);
320 m_ring_map_lock.unlock();
321 return;
322 }
323 BULLSEYE_EXCLUDE_BLOCK_END
324
325 //decrease ref count
326 iter->second--;
327
328 if (iter->second == 0) {
329 m_ring_map.erase(iter);
330
331 // remove cq channel fd from the epfd
332 size_t num_ring_rx_fds;
333 int *ring_rx_fds_array = ring->get_rx_channel_fds(num_ring_rx_fds);
334 for (size_t i = 0; i < num_ring_rx_fds; i++) {
335 // delete cq fd from epfd
336 int ret = orig_os_api.epoll_ctl(m_epfd, EPOLL_CTL_DEL, ring_rx_fds_array[i], NULL);
337 BULLSEYE_EXCLUDE_BLOCK_START
338 if (ret < 0) {
339 __log_dbg("failed to remove cq fd=%d from epfd=%d (errno=%d %m)",
340 ring_rx_fds_array[i], m_epfd, errno);
341 } else {
342 __log_dbg("remove cq fd=%d from epfd=%d", ring_rx_fds_array[i], m_epfd);
343 }
344 BULLSEYE_EXCLUDE_BLOCK_END
345 }
346 }
347 m_ring_map_lock.unlock();
348}
349

Callers 1

Calls 5

eraseMethod · 0.80
lockMethod · 0.45
endMethod · 0.45
unlockMethod · 0.45
get_rx_channel_fdsMethod · 0.45

Tested by

no test coverage detected