DragonFly BSD
DragonFly submit List (threaded) for 2005-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ALTQ


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Feb 2005 18:50:09 -0800 (PST)

    I like this a lot better though I think you might as well just #ifdef
    the sections in the inline rather then use the ALTQF_ENABLED = 0 trick
    to make the compiler post-process-out those sections.

    I'm wondering if we should just incorporate the whole mess into 
    if_enqueue(), but that could be left to a later date.  I can live
    with the inline for now :-)

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>

:...
:#ifndef ALTQ
:#define ALTQF_ENABLED 0
:#endif
:
:static int __inline
:ifq_enqueue(struct ifqueue *ifq, struct mbuf *m, struct altq_pktattr *pattr)   
:{
:        int error;
:
:        if (ifq->altq_flags & ALTQF_ENABLED) {                 
:                error = (*ifq->altq_enqueue)(ifq, m, pattr);
:        } else {                        /* non-altq case */
:                if (if_qfull(ifq)) {             
:                        m_freem(m);
:                        error = ENOBUFS;
:                } else {       
:                        if_enqueue(ifq, m);
:                        error = 0;
:                }
:        }
:        if (error)                                                        
:                ifq->ifq_drops++;                                      
:        return error;
:} 
:
:static int __inline
:ifq_handoff(struct ifnet *ifp, struct mbuf *m, struct altq_pktattr *packetattr)
:{
:        int error, s;
:
:        s = splimp();
:        error = ifq_enqueue(&ifp->if_snd, m, packetattr);
:        if (error == 0) {
:                ifp->if_obytes += m->m_pkthdr.len;
:                if (m->m_flags & M_MCAST)
:                        ifp->if_omcasts++;
:                if (!(ifp->if_flags & IFF_OACTIVE))
:                        (*ifp->if_start)(ifp);
:        }
:        return error;
:}




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]