Next | Prev | Up | Top | Contents | Index

Input Queueing Example

This is a code fragment of an interrupt handler that queues an input packet pointed to by m onto the ip input queue. schednetisr() is called to schedule processing of that packet.

The code assumed to be already at splimp().

{
    ...

      ifq = &ipintrq; /* the ip protocol queue */

 /*
 * If queue is full, we drop the packet.
 */
 IFQ_LOCK(ifq);
 if (IF_QFULL(ifq)) {
 m_freem(m);
 IF_DROP(ifq);
 IFQ_UNLOCK(ifq);
 return(-1);
 }

 IF_ENQUEUE_NOLOCK(ifq, m);
 schednetisr(NETISR_IP); /* schedule ip interrupt */
 IFQ_UNLOCK(ifq);
 return(0);
}


Next | Prev | Up | Top | Contents | Index