| 421 | } |
| 422 | |
| 423 | static __inline struct mbuf * |
| 424 | drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br, |
| 425 | int (*func) (struct mbuf *, void *), void *arg) |
| 426 | { |
| 427 | struct mbuf *m; |
| 428 | #ifdef ALTQ |
| 429 | if (ALTQ_IS_ENABLED(&ifp->if_snd)) { |
| 430 | IFQ_LOCK(&ifp->if_snd); |
| 431 | IFQ_POLL_NOLOCK(&ifp->if_snd, m); |
| 432 | if (m != NULL && func(m, arg) == 0) { |
| 433 | IFQ_UNLOCK(&ifp->if_snd); |
| 434 | return (NULL); |
| 435 | } |
| 436 | IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m); |
| 437 | IFQ_UNLOCK(&ifp->if_snd); |
| 438 | return (m); |
| 439 | } |
| 440 | #endif |
| 441 | m = (struct mbuf *)buf_ring_peek(br); |
| 442 | if (m == NULL || func(m, arg) == 0) |
| 443 | return (NULL); |
| 444 | |
| 445 | return ((struct mbuf *)buf_ring_dequeue_sc(br)); |
| 446 | } |
| 447 | |
| 448 | static __inline int |
| 449 | drbr_empty(struct ifnet *ifp, struct buf_ring *br) |
nothing calls this directly
no test coverage detected