Re: ALTQ

看板DFBSD_submit作者時間21年前 (2005/02/11 11:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串6/8 (看更多)
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@backplane.com> :... :#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; :}
文章代碼(AID): #1231_r00 (DFBSD_submit)
討論串 (同標題文章)
文章代碼(AID): #1231_r00 (DFBSD_submit)