* SWI handler for netisr -- processes packets in a set of workstreams that * it owns, woken up by calls to NWS_SIGNAL(). If this workstream is already * being direct dispatched, go back to sleep and wait for the dispatching * thread to wake us up again. */
| 935 | * thread to wake us up again. |
| 936 | */ |
| 937 | static void |
| 938 | swi_net(void *arg) |
| 939 | { |
| 940 | #ifdef NETISR_LOCKING |
| 941 | struct rm_priotracker tracker; |
| 942 | #endif |
| 943 | struct netisr_workstream *nwsp; |
| 944 | u_int bits, prot; |
| 945 | |
| 946 | nwsp = arg; |
| 947 | |
| 948 | #ifdef DEVICE_POLLING |
| 949 | KASSERT(nws_count == 1, |
| 950 | ("%s: device_polling but nws_count != 1", __func__)); |
| 951 | netisr_poll(); |
| 952 | #endif |
| 953 | #ifdef NETISR_LOCKING |
| 954 | NETISR_RLOCK(&tracker); |
| 955 | #endif |
| 956 | NWS_LOCK(nwsp); |
| 957 | KASSERT(!(nwsp->nws_flags & NWS_RUNNING), ("swi_net: running")); |
| 958 | if (nwsp->nws_flags & NWS_DISPATCHING) |
| 959 | goto out; |
| 960 | nwsp->nws_flags |= NWS_RUNNING; |
| 961 | nwsp->nws_flags &= ~NWS_SCHEDULED; |
| 962 | while ((bits = nwsp->nws_pendingbits) != 0) { |
| 963 | while ((prot = ffs(bits)) != 0) { |
| 964 | prot--; |
| 965 | bits &= ~(1 << prot); |
| 966 | (void)netisr_process_workstream_proto(nwsp, prot); |
| 967 | } |
| 968 | } |
| 969 | nwsp->nws_flags &= ~NWS_RUNNING; |
| 970 | out: |
| 971 | NWS_UNLOCK(nwsp); |
| 972 | #ifdef NETISR_LOCKING |
| 973 | NETISR_RUNLOCK(&tracker); |
| 974 | #endif |
| 975 | #ifdef DEVICE_POLLING |
| 976 | netisr_pollmore(); |
| 977 | #endif |
| 978 | } |
| 979 | |
| 980 | void inline |
| 981 | ff_swi_net_excute(void) |
no test coverage detected