| 986 | } |
| 987 | |
| 988 | static int |
| 989 | netisr_queue_workstream(struct netisr_workstream *nwsp, u_int proto, |
| 990 | struct netisr_work *npwp, struct mbuf *m, int *dosignalp) |
| 991 | { |
| 992 | |
| 993 | NWS_LOCK_ASSERT(nwsp); |
| 994 | |
| 995 | *dosignalp = 0; |
| 996 | if (npwp->nw_len < npwp->nw_qlimit) { |
| 997 | m->m_nextpkt = NULL; |
| 998 | if (npwp->nw_head == NULL) { |
| 999 | npwp->nw_head = m; |
| 1000 | npwp->nw_tail = m; |
| 1001 | } else { |
| 1002 | npwp->nw_tail->m_nextpkt = m; |
| 1003 | npwp->nw_tail = m; |
| 1004 | } |
| 1005 | npwp->nw_len++; |
| 1006 | if (npwp->nw_len > npwp->nw_watermark) |
| 1007 | npwp->nw_watermark = npwp->nw_len; |
| 1008 | |
| 1009 | /* |
| 1010 | * We must set the bit regardless of NWS_RUNNING, so that |
| 1011 | * swi_net() keeps calling netisr_process_workstream_proto(). |
| 1012 | */ |
| 1013 | nwsp->nws_pendingbits |= (1 << proto); |
| 1014 | if (!(nwsp->nws_flags & |
| 1015 | (NWS_RUNNING | NWS_DISPATCHING | NWS_SCHEDULED))) { |
| 1016 | nwsp->nws_flags |= NWS_SCHEDULED; |
| 1017 | *dosignalp = 1; /* Defer until unlocked. */ |
| 1018 | } |
| 1019 | npwp->nw_queued++; |
| 1020 | return (0); |
| 1021 | } else { |
| 1022 | m_freem(m); |
| 1023 | npwp->nw_qdrops++; |
| 1024 | return (ENOBUFS); |
| 1025 | } |
| 1026 | } |
| 1027 | |
| 1028 | static int |
| 1029 | netisr_queue_internal(u_int proto, struct mbuf *m, u_int cpuid) |
no test coverage detected