| 565 | } |
| 566 | |
| 567 | int |
| 568 | rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle, |
| 569 | rte_intr_callback_fn cb_fn, void *cb_arg, |
| 570 | rte_intr_unregister_callback_fn ucb_fn) |
| 571 | { |
| 572 | int ret; |
| 573 | struct rte_intr_source *src; |
| 574 | struct rte_intr_callback *cb, *next; |
| 575 | |
| 576 | /* do parameter checking first */ |
| 577 | if (rte_intr_fd_get(intr_handle) < 0) { |
| 578 | RTE_LOG(ERR, EAL, "Unregistering with invalid input parameter\n"); |
| 579 | return -EINVAL; |
| 580 | } |
| 581 | |
| 582 | rte_spinlock_lock(&intr_lock); |
| 583 | |
| 584 | /* check if the interrupt source for the fd is existent */ |
| 585 | TAILQ_FOREACH(src, &intr_sources, next) { |
| 586 | if (rte_intr_fd_get(src->intr_handle) == rte_intr_fd_get(intr_handle)) |
| 587 | break; |
| 588 | } |
| 589 | |
| 590 | /* No interrupt source registered for the fd */ |
| 591 | if (src == NULL) { |
| 592 | ret = -ENOENT; |
| 593 | |
| 594 | /* only usable if the source is active */ |
| 595 | } else if (src->active == 0) { |
| 596 | ret = -EAGAIN; |
| 597 | |
| 598 | } else { |
| 599 | ret = 0; |
| 600 | |
| 601 | /* walk through the callbacks and mark all that match. */ |
| 602 | for (cb = TAILQ_FIRST(&src->callbacks); cb != NULL; cb = next) { |
| 603 | next = TAILQ_NEXT(cb, next); |
| 604 | if (cb->cb_fn == cb_fn && (cb_arg == (void *)-1 || |
| 605 | cb->cb_arg == cb_arg)) { |
| 606 | cb->pending_delete = 1; |
| 607 | cb->ucb_fn = ucb_fn; |
| 608 | ret++; |
| 609 | } |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | rte_spinlock_unlock(&intr_lock); |
| 614 | |
| 615 | return ret; |
| 616 | } |
| 617 | |
| 618 | int |
| 619 | rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, |
no test coverage detected