コード例 #1
0
/* totally bogus -- d11 hdr only + tx hdrs */
static void *
wlc_olpc_get_pkt(wlc_info_t *wlc, uint ac, uint* fifo)
{
    int buflen = (TXOFF + WL_OLPC_PKT_LEN);
    void* p = NULL;
    osl_t *osh = wlc->osh;
    const char* macaddr = NULL;
    struct dot11_header *hdr = NULL;

    if ((p = PKTGET(osh, buflen, TRUE)) == NULL) {
        WL_ERROR(("wl%d: %s: pktget error for len %d \n",
                  wlc->pub->unit, __FUNCTION__, buflen));
        goto fatal;
    }
    macaddr = WLC_MACADDR(wlc);

    WL_NONE(("pkt manip\n"));
    /* reserve TXOFF bytes of headroom */
    PKTPULL(osh, p, TXOFF);
    PKTSETLEN(osh, p, WL_OLPC_PKT_LEN);

    WL_NONE(("d11_hdr\n"));
    hdr = (struct dot11_header*)PKTDATA(osh, p);
    bzero((char*)hdr, WL_OLPC_PKT_LEN);
    hdr->fc = htol16(FC_DATA);
    hdr->durid = 0;
    bcopy((const char*)macaddr, (char*)&(hdr->a1.octet), ETHER_ADDR_LEN);
    bcopy((const char*)macaddr, (char*)&(hdr->a2.octet), ETHER_ADDR_LEN);
    bcopy((const char*)macaddr, (char*)&(hdr->a3.octet), ETHER_ADDR_LEN);
    hdr->seq = 0;
    WL_NONE(("prep raw 80211\n"));
    wlc->olpc_info->tx_cal_pkts = TRUE;
    /* frameid returned here -- ignore for now -- may speed up using this */
    (void)wlc_prep80211_raw(wlc, NULL, ac, TRUE, p, fifo);
    wlc->olpc_info->tx_cal_pkts = FALSE;

    return p;
fatal:
    return (NULL);
}
コード例 #2
0
ファイル: hnddma.c プロジェクト: ariavie/bcm
/* returns a pointer to the next frame received, or NULL if there are no more */
void*
dma_rx(dma_info_t *di)
{
	void *p;
	uint len;
	int skiplen = 0;

	while ((p = dma_getnextrxp(di, FALSE))) {
		/* skip giant packets which span multiple rx descriptors */
		if (skiplen > 0) {
			skiplen -= di->rxbufsize;
			if (skiplen < 0)
				skiplen = 0;
			PKTFREE(di->drv, p, FALSE);
			continue;
		}

		len = ltoh16(*(uint16*)(PKTDATA(di->drv, p)));
		DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));

		/* bad frame length check */
		if (len > (di->rxbufsize - di->rxoffset)) {
			DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", di->name, len));
			if (len > 0)
				skiplen = len - (di->rxbufsize - di->rxoffset);
			PKTFREE(di->drv, p, FALSE);
			di->hnddma.rxgiants++;
			continue;
		}

		/* set actual length */
		PKTSETLEN(di->drv, p, (di->rxoffset + len));

		break;
	}

	return (p);
}
コード例 #3
0
int
bcm_rpc_buf_len_set(rpc_tp_info_t * rpc_th, rpc_buf_t* b, uint len)
{
	PKTSETLEN(rpc_th->osh, b, len);
	return 0;
}