当前位置: 首页>>代码示例>>C++>>正文


C++ IF_DEQUEUE函数代码示例

本文整理汇总了C++中IF_DEQUEUE函数的典型用法代码示例。如果您正苦于以下问题:C++ IF_DEQUEUE函数的具体用法?C++ IF_DEQUEUE怎么用?C++ IF_DEQUEUE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IF_DEQUEUE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pppdealloc

/*
 * Deallocate a ppp unit.  Must be called at splsoftnet or higher.
 */
void
pppdealloc(struct ppp_softc *sc)
{
    struct ppp_pkt *pkt;
    struct mbuf *m;

    splsoftassert(IPL_SOFTNET);

    if_down(&sc->sc_if);
    sc->sc_if.if_flags &= ~(IFF_UP|IFF_RUNNING);
    sc->sc_devp = NULL;
    sc->sc_xfer = 0;
    while ((pkt = ppp_pkt_dequeue(&sc->sc_rawq)) != NULL)
	ppp_pkt_free(pkt);
    while ((m = mq_dequeue(&sc->sc_inq)) != NULL)
	m_freem(m);
    for (;;) {
	IF_DEQUEUE(&sc->sc_fastq, m);
	if (m == NULL)
	    break;
	m_freem(m);
    }
    while ((m = sc->sc_npqueue) != NULL) {
	sc->sc_npqueue = m->m_nextpkt;
	m_freem(m);
    }
    m_freem(sc->sc_togo);
    sc->sc_togo = NULL;

#ifdef PPP_COMPRESS
    ppp_ccp_closed(sc);
    sc->sc_xc_state = NULL;
    sc->sc_rc_state = NULL;
#endif /* PPP_COMPRESS */
#if NBPFILTER > 0
    if (sc->sc_pass_filt.bf_insns != 0) {
	free(sc->sc_pass_filt.bf_insns, M_DEVBUF, 0);
	sc->sc_pass_filt.bf_insns = 0;
	sc->sc_pass_filt.bf_len = 0;
    }
    if (sc->sc_active_filt.bf_insns != 0) {
	free(sc->sc_active_filt.bf_insns, M_DEVBUF, 0);
	sc->sc_active_filt.bf_insns = 0;
	sc->sc_active_filt.bf_len = 0;
    }
#endif
#ifdef VJC
    if (sc->sc_comp != 0) {
	free(sc->sc_comp, M_DEVBUF, 0);
	sc->sc_comp = 0;
    }
#endif
}
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:56,代码来源:if_ppp.c

示例2: iavc_start_tx

static void iavc_start_tx(iavc_softc_t *sc)
{
    struct mbuf *m;
    u_int32_t txlen;

    /* If device has put us on hold, punt. */

    if (sc->sc_blocked) {
	return;
    }

    /* If using DMA and transmitter busy, punt. */
    if (sc->sc_dma && (sc->sc_csr & EN_TX_TC_INT)) {
	return;
    }

    /* Else, see if we have messages to send. */
    IF_DEQUEUE(&sc->sc_txq, m);
    if (!m) {
	return;
    }

    /* Have message, will send. */
    if (CAPIMSG_LEN(m->m_data)) {
	/* A proper CAPI message, possibly with B3 data */
	txlen = iavc_tx_capimsg(sc, m);
    } else {
	/* A board control message to be sent as is */
	txlen = iavc_tx_ctrlmsg(sc, m);
    }

    if (m->m_next) {
	i4b_Bfreembuf(m->m_next);
	m->m_next = NULL;
    }
    i4b_Dfreembuf(m);

    /* Kick DMA into motion if applicable */
    if (sc->sc_dma) {
	txlen = (txlen + 3) & ~3;

	bus_dmamap_sync(sc->dmat, sc->tx_map, 0, txlen,
	  BUS_DMASYNC_PREWRITE);

	AMCC_WRITE(sc, AMCC_TXPTR, sc->tx_map->dm_segs[0].ds_addr);
	AMCC_WRITE(sc, AMCC_TXLEN, txlen);
	sc->sc_csr |= EN_TX_TC_INT;

	if (!sc->sc_intr)
	    AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr);
    }
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:52,代码来源:iavc.c

示例3: snstart

/*
 * Encapsulate a packet of type family for the local net.
 */
static void
snstart(struct ifnet *ifp)
{
	struct sn_softc	*sc = ifp->if_softc;
	struct mbuf	*m;
	int		mtd_next;

	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
		return;

outloop:
	/* Check for room in the xmit buffer. */
	if ((mtd_next = (sc->mtd_free + 1)) == NTDA)
		mtd_next = 0;

	if (mtd_next == sc->mtd_hw) {
		ifp->if_flags |= IFF_OACTIVE;
		return;
	}

	IF_DEQUEUE(&ifp->if_snd, m);
	if (m == 0)
		return;

	/* We need the header for m_pkthdr.len. */
	if ((m->m_flags & M_PKTHDR) == 0)
		panic("%s: snstart: no header mbuf", device_xname(sc->sc_dev));

	/*
	 * If bpf is listening on this interface, let it
	 * see the packet before we commit it to the wire.
	 */
	bpf_mtap(ifp, m);

	/*
	 * If there is nothing in the o/p queue, and there is room in
	 * the Tx ring, then send the packet directly.  Otherwise append
	 * it to the o/p queue.
	 */
	if ((sonicput(sc, m, mtd_next)) == 0) {
		IF_PREPEND(&ifp->if_snd, m);
		return;
	}

	sc->mtd_prev = sc->mtd_free;
	sc->mtd_free = mtd_next;

	ifp->if_opackets++;		/* # of pkts */

	/* Jump back for possibly more punishment. */
	goto outloop;
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:55,代码来源:if_sn.c

示例4: scestart

void
scestart(int unit)
{
	sce_softc_t ssc = scegetssc(unit);
	scsit_return_t sr;
	struct ifnet *ifp;
	io_req_t ior;
	TR_DECL("scestart");

	tr2("enter: unit = 0x%x", unit);

	assert(ssc != NULL_SSC);

	ifp = &ssc->sce_if;
	IF_DEQUEUE(&ifp->if_snd, ior);
      dequeued:
	while(ior) {
		struct ether_header *ehp = (struct ether_header *)ior->io_data;
		scsit_handle_t handle;

		bcopy((const char *)sce_fake_addr,(char *)&ehp->ether_shost,6);

		sr = scsit_handle_alloc(&handle);
		assert(sr == SCSIT_SUCCESS);

		tr1("sending");
		sr = scsit_send(handle,
				ssc->node,
				sce_lun,
				(void *)ior,
				(char *)ehp,
				ior->io_count,
				FALSE);
		assert(sr == SCSIT_SUCCESS);
		IF_DEQUEUE(&ifp->if_snd, ior);
	}
	tr1("exit");
}
开发者ID:rohsaini,项目名称:mkunity,代码行数:38,代码来源:if_sce.c

示例5: hdintr

hdintr ()
{
	register struct mbuf *m;
	register struct hdcb *hdp;
	register struct ifnet *ifp;
	register int s;
	static struct ifnet *lastifp;
	static struct hdcb *lasthdp;

	for (;;) {
		s = splimp ();
		IF_DEQUEUE (&hdintrq, m);
		splx (s);
		if (m == 0)
			break;
		if (m->m_len < HDHEADERLN) {
			printf ("hdintr: packet too short (len=%d)\n",
				m->m_len);
			m_freem (m);
			continue;
		}
		if ((m->m_flags & M_PKTHDR) == 0)
			panic("hdintr");
		ifp = m->m_pkthdr.rcvif;

		/*
		 * look up the appropriate hdlc control block
		 */

		if (ifp == lastifp)
			hdp = lasthdp;
		else {
			for (hdp = hdcbhead; hdp; hdp = hdp->hd_next)
				if (hdp->hd_ifp == ifp)
					break;
			if (hdp == 0) {
				printf ("hdintr: unknown interface %x\n", ifp);
				m_freem (m);
				continue;
			}
			lastifp = ifp;
			lasthdp = hdp;
		}

		/* Process_rxframe returns FALSE if the frame was NOT queued
		   for the next higher layers. */
		if (process_rxframe (hdp, m) == FALSE)
			m_freem (m);
	}
}
开发者ID:ShanghaiTimes,项目名称:original-bsd,代码行数:50,代码来源:hd_input.c

示例6: xilTemacTxThreadSingle

void xilTemacTxThreadSingle(struct ifnet* ifp)
{
  struct XilTemac* xilTemac = ifp->if_softc;
  struct mbuf*     m;
  uint32_t base = xilTemac->iAddr;

#ifdef DEBUG
  printk("%s: tx send packet, interface '%s'\n", DRIVER_PREFIX, xilTemac->iUnitName );
#endif

  /* Send packets till mbuf queue empty or tx fifo full */
  for(;;) {
    uint32_t i = 0;

    /* 1) clear out any statuses from previously sent tx frames */
    while( IN32(base + XTE_IPISR_OFFSET) & XTE_IPXR_XMIT_DONE_MASK ) {
      IN32(base + XTE_TSR_OFFSET);
      OUT32(base + XTE_IPISR_OFFSET, XTE_IPXR_XMIT_DONE_MASK);
      i++;
    }
    if( i > xilTemac->iStats.iTxMaxDrained ) {
      xilTemac->iStats.iTxMaxDrained = i;
    }

    /* 2) Check if enough space in tx data fifo _and_ tx tplr for an entire
       ethernet frame */
    if( xilTemacTxFifoVacancyBytes( xilTemac->iAddr ) <= ifp->if_mtu ) {
      /* 2a) If not, enable transmit done interrupt and break out of loop to
         wait for space */
      uint32_t ipier = IN32(base + XTE_IPIER_OFFSET);
      ipier |= (XTE_IPXR_XMIT_DONE_MASK);
      OUT32(base + XTE_IPIER_OFFSET, ipier);
      break;
    }

    /* 3) Contuine to dequeue mbuf chains till none left */
    IF_DEQUEUE( &(ifp->if_snd), m);
    if( !m ) {
      break;
    }

    /* 4) Send dequeued mbuf chain */
    xilTemacSendPacket( ifp, m );

    /* 5) Free mbuf chain */
    m_freem( m );
  }
  ifp->if_flags &= ~IFF_OACTIVE;
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:49,代码来源:xiltemac.c

示例7: compat_read

static status_t
compat_read(void *cookie, off_t position, void *buffer, size_t *numBytes)
{
	struct ifnet *ifp = cookie;
	uint32 semFlags = B_CAN_INTERRUPT;
	status_t status;
	struct mbuf *mb;
	size_t length;

	//if_printf(ifp, "compat_read(%lld, %p, [%lu])\n", position,
	//	buffer, *numBytes);

	if (ifp->flags & DEVICE_CLOSED)
		return B_INTERRUPTED;

	if (ifp->flags & DEVICE_NON_BLOCK)
		semFlags |= B_RELATIVE_TIMEOUT;

	do {
		status = acquire_sem_etc(ifp->receive_sem, 1, semFlags, 0);
		if (ifp->flags & DEVICE_CLOSED)
			return B_INTERRUPTED;

		if (status == B_WOULD_BLOCK) {
			*numBytes = 0;
			return B_OK;
		} else if (status < B_OK)
			return status;

		IF_DEQUEUE(&ifp->receive_queue, mb);
	} while (mb == NULL);

	length = min_c(max_c((size_t)mb->m_pkthdr.len, 0), *numBytes);

#if 0
	mb = m_defrag(mb, 0);
	if (mb == NULL) {
		*numBytes = 0;
		return B_NO_MEMORY;
	}
#endif

	m_copydata(mb, 0, length, buffer);
	*numBytes = length;

	m_freem(mb);
	return B_OK;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:48,代码来源:device.c

示例8: pflogstart

/*
 * Start output on the pflog interface.
 */
void
pflogstart(struct ifnet *ifp)
{
	struct mbuf *m;
	int s;

	for (;;) {
		s = splnet();
		IF_DROP(&ifp->if_snd);
		IF_DEQUEUE(&ifp->if_snd, m);
		splx(s);

		if (m == NULL)
			return;
		m_freem(m);
	}
}
开发者ID:DavidAlphaFox,项目名称:openbsd-kernel,代码行数:20,代码来源:if_pflog.c

示例9: rbch_clrq

/*---------------------------------------------------------------------------*
 *	clear an hdlc rx queue for a rbch unit
 *---------------------------------------------------------------------------*/
static void
rbch_clrq(void *softc)
{
	struct rbch_softc *sc = softc;
	struct mbuf *m;
	int s;

	for(;;)
	{
		s = splnet();
		IF_DEQUEUE(&sc->sc_hdlcq, m);
		splx(s);

		if(m)
			m_freem(m);
		else
			break;
	}
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:22,代码来源:i4b_rbch.c

示例10: ieee80211_drain_ifq

void
ieee80211_drain_ifq(struct ifqueue* ifq)
{
	struct ieee80211_node* ni;
	struct mbuf* m;

	for (;;) {
		IF_DEQUEUE(ifq, m);
		if (m == NULL)
			break;

		ni = (struct ieee80211_node*)m->m_pkthdr.rcvif;
		KASSERT(ni != NULL, ("frame w/o node"));
		ieee80211_free_node(ni);
		m->m_pkthdr.rcvif = NULL;

		m_freem(m);
	}
}
开发者ID:sahil9912,项目名称:haiku,代码行数:19,代码来源:ieee80211_haiku.cpp

示例11: fwe_start

static void
fwe_start(struct ifnet *ifp)
{
	struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
	int s;

	FWEDEBUG(ifp, "starting\n");

	if (fwe->dma_ch < 0) {
		struct mbuf	*m = NULL;

		FWEDEBUG(ifp, "not ready\n");

		s = splimp();
		do {
			IF_DEQUEUE(&ifp->if_snd, m);
			if (m != NULL)
				m_freem(m);
			ifp->if_oerrors ++;
		} while (m != NULL);
		splx(s);

		return;
	}

	s = splimp();
#if defined(__FreeBSD__)
	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
#else
	ifp->if_flags |= IFF_OACTIVE;
#endif

	if (ifp->if_snd.ifq_len != 0)
		fwe_as_output(fwe, ifp);

#if defined(__FreeBSD__)
	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
#else
	ifp->if_flags &= ~IFF_OACTIVE;
#endif
	splx(s);
}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:42,代码来源:if_fwe.c

示例12: isdntrcread

/*---------------------------------------------------------------------------*
 *	read from trace device
 *---------------------------------------------------------------------------*/
PDEVSTATIC int
isdntrcread(dev_t dev, struct uio * uio, int ioflag)
{
	struct mbuf *m;
	int x;
	int error = 0;
	int unit = minor(dev);
	
	if(!(device_state[unit] & ST_ISOPEN))
		return(EIO);

	x = splnet();
	
	while(IF_QEMPTY(&trace_queue[unit]) && (device_state[unit] & ST_ISOPEN))
	{
		device_state[unit] |= ST_WAITDATA;
		
		if((error = tsleep((caddr_t) &trace_queue[unit],
					TTIPRI | PCATCH,
					"bitrc", 0 )) != 0)
		{
			device_state[unit] &= ~ST_WAITDATA;
			splx(x);
			return(error);
		}
	}

	IF_DEQUEUE(&trace_queue[unit], m);

	if(m && m->m_len)
		error = uiomove(m->m_data, m->m_len, uio);
	else
		error = EIO;
		
	if(m)
		i4b_Bfreembuf(m);

	splx(x);
	
	return(error);
}
开发者ID:MarginC,项目名称:kame,代码行数:44,代码来源:i4b_trace.c

示例13: tx_daemon

static void tx_daemon(void *arg)
{
  struct ifnet *ifp = &arpcom.ac_if;
  rtems_event_set events;
  struct mbuf *m;
  
  while(1) {
    rtems_bsdnet_event_receive(START_TRANSMIT_EVENT,
      RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
    while(1) {
      IF_DEQUEUE(&ifp->if_snd, m);
      if(m == NULL)
        break;
      rtems_bsdnet_event_receive(CTS_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT,
        RTEMS_NO_TIMEOUT, &events);
      send_packet(ifp, m);
      m_freem(m);
    }
    ifp->if_flags &= ~IFF_OACTIVE;
  }
}
开发者ID:RTEMS,项目名称:rtems,代码行数:21,代码来源:network.c

示例14: uether_rxflush

void
uether_rxflush(struct usb_ether *ue)
{
	struct ifnet *ifp = uether_getifp(ue);
	struct mbuf *m;

	UE_LOCK_ASSERT(ue);

	for (;;) {
		IF_DEQUEUE(&ue->ue_rxq, m);
		if (m == NULL)
			break;

		/*
		 * The USB xfer has been resubmitted so its safe to unlock now.
		 */
		UE_UNLOCK(ue);
		ifp->if_input(ifp, m, NULL, -1);
		UE_LOCK(ue);
	}
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:21,代码来源:usb_ethernet.c

示例15: cdce_start

Static void
cdce_start(struct ifnet *ifp)
{
    struct cdce_softc	*sc;
    struct mbuf		*m_head = NULL;

    sc = ifp->if_softc;
    CDCE_LOCK(sc);


    if (sc->cdce_dying ||
            ifp->if_flags & IFF_OACTIVE ||
            !(ifp->if_flags & IFF_RUNNING)) {
        CDCE_UNLOCK(sc);
        return;
    }

    IF_DEQUEUE(&ifp->if_snd, m_head);
    if (m_head == NULL) {
        CDCE_UNLOCK(sc);
        return;
    }

    if (cdce_encap(sc, m_head, 0)) {
        IF_PREPEND(&ifp->if_snd, m_head);
        ifp->if_flags |= IFF_OACTIVE;
        CDCE_UNLOCK(sc);
        return;
    }

    BPF_MTAP(ifp, m_head);

    ifp->if_flags |= IFF_OACTIVE;

    CDCE_UNLOCK(sc);

    return;
}
开发者ID:MarginC,项目名称:kame,代码行数:38,代码来源:if_cdce.c


注:本文中的IF_DEQUEUE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。