Exemple #1
0
STATUS endEtherPacketAddrGet
    (
    M_BLK_ID pMblk, /* pointer to packet */
    M_BLK_ID pSrc,  /* pointer to local source address */
    M_BLK_ID pDst,  /* pointer to local destination address */
    M_BLK_ID pESrc, /* pointer to remote source address (if any) */
    M_BLK_ID pEDst  /* pointer to remote destination address (if any) */
    )
    {

    if (pSrc != NULL)
        {
        pSrc = netMblkDup (pMblk, pSrc);
        pSrc->mBlkHdr.mData += 6;
        pSrc->mBlkHdr.mLen = 6;
        }
    if (pDst != NULL)
        {
        pDst = netMblkDup (pMblk, pDst);
        pDst->mBlkHdr.mLen = 6;
        }
    if (pESrc != NULL)
        {
        pESrc = netMblkDup (pMblk, pESrc);
        pESrc->mBlkHdr.mData += 6;
        pESrc->mBlkHdr.mLen = 6;
        }
    if (pEDst != NULL)
        {
        pEDst = netMblkDup (pMblk, pEDst);
        pEDst->mBlkHdr.mLen = 6;
        }
    
    return (OK);
    }
Exemple #2
0
LOCAL STATUS wdbEndPoll
    (
    void *	pDev
    )
    {
    long 		type;
    M_BLK_ID 		pMblk;
    WDB_END_PKT_DEV * 	pPktDev = pDev;
    LL_HDR_INFO  	llHdrInfo;
    int			mode = WDB_COMM_MODE_POLL; 
    END_OBJ * 		pEnd = PCOOKIE_TO_ENDOBJ(pPktDev->pCookie);

    /* Reset the size to the maximum. */

    pPktDev->pInBlk->mBlkHdr.mLen = pPktDev->pInBlk->pClBlk->clSize;
    pPktDev->pInBlk->mBlkHdr.mData = pPktDev->pInBlk->pClBlk->clNode.pClBuf;

#ifdef WDB_NPT_CAPABLE
    if (muxTkPollReceive (pPktDev->pCookie, pPktDev->pInBlk, NULL) == OK)
#else
    if (muxPollReceive (pPktDev->pCookie, pPktDev->pInBlk) == OK)
#endif /* WDB_NPT_CAPABLE */
	{
        if ((pMblk = mBlkGet (pEnd->pNetPool, M_DONTWAIT, MT_DATA)) == NULL)
            return (ERROR);

        /* duplicate the received mBlk so that wdbEndInt can free it */

        pMblk = netMblkDup (pPktDev->pInBlk, pMblk);

#ifndef WDB_NPT_CAPABLE
        if (muxPacketDataGet (pPktDev->pCookie, pMblk, &llHdrInfo) == ERROR)
	    {
	    return (ERROR);
	    }
#else
	if ((pEnd->mib2Tbl.ifType == M2_ifType_ethernet_csmacd) ||
	    (pEnd->mib2Tbl.ifType == M2_ifType_iso88023_csmacd))
	    {
	    if (endEtherPacketDataGet (pMblk, &llHdrInfo) == ERROR)
		{
		return (ERROR);
		}
	    }
	else
	    return ERROR;
#endif /* WDB_NPT_CAPABLE */

        type = llHdrInfo.pktType;

        if (wdbEndInt (pPktDev->pCookie, type, pMblk, &llHdrInfo,
                       (void *)&mode) == TRUE)
            return (OK);
        return (ERROR);
        }
    else
        {
        return (ERROR);
        }
    }
Exemple #3
0
void et_drv_rx_q_pkts(int unit, M_BLK_ID pMblk, int dummy)
{
    M_BLK_ID qMblk;
    M_BLK_ID newMblk, newId;
    int s;

    newMblk = netMblkGet(et_drv_txrx_info[unit].et_drvNetPoolID,
                         M_DONTWAIT, MT_DATA);
    if (newMblk == NULL) {
        printf("et_drv_rx_q_pkts : Failed to allocate mbuf\n");
        et_drv_txrx_info[unit].tx_fail++;
        return;
    }
    newId = netMblkDup(pMblk, newMblk);
    if (newId == NULL) {
        printf("dup failed \n");
        return;
    }

    s = intLock();
    if (et_drv_txrx_info[unit].rx_tail == NULL ) {
        et_drv_txrx_info[unit].rx_tail = newId;
        et_drv_txrx_info[unit].rx_head = newId;
    } else {
        qMblk = et_drv_txrx_info[unit].rx_tail;
        qMblk->mBlkHdr.mNextPkt = newId;
        et_drv_txrx_info[unit].rx_tail = newId;
        newId->mBlkHdr.mNextPkt = NULL;
    }
    intUnlock(s);
    
    ET_DRV_TXRX_PRINT("Queued a packet %08x\n", (int)pMblk, 2, 3, 4, 5, 6);

    /* Indicate that a packet is available */
    /* semTake(et_drv_txrx_info.rx_sem, WAIT_FOREVER); */
}
Exemple #4
0
void
socend_receive_netjob(int pi, int pckti, int pckt_size)
/*
 * Function: 	socend_receive_netjob
 * Purpose:	Called from netjob after packet arrives.
 * Parameters:	p - pointer to (se), cookied passed on registration
 *		pckpi - pointer to packet data (int form).
 *		pckt_size - received length of packet.
 * Returns:	Nothing
 */
{
    socend_t		*se = (socend_t *)pi;
    struct end_object 	*eo = &se->se_eo;
    void		*pckt = (void *)pckti;
    bcm_vlan_t		vid;
    CL_BLK_ID		cb = NULL;
    M_BLK_ID		mb = NULL;

    /* Check the DCB for errors */
#if defined(BROADCOM_DEBUG)			/* Only compile in for debug */
    if (LOG_CHECK(BSL_LS_SYS_END | BSL_INFO) &&
        LOG_CHECK(BSL_LS_SOC_PACKET | BSL_INFO)) {
	d_packet_format("socend RX", DECODE_ETHER, pckt, pckt_size, NULL);
    }
#endif /* BROADCOM_DEBUG */
    /*
     * Build Cluster - then attach to mblks, 1 for each interface that
     * should get the packet. Broadcast/Multicast packets go up all the stacks.
     *
     * For multicast, it should only go up stacks that have registered for that
     * address, but for now, this will allow multiple interfaces to work.
     */

    if ((NULL == (cb = netClBlkGet(eo->pNetPool, M_DONTWAIT)))) {
	if (mb) netMblkFree(eo->pNetPool, mb);
	netClFree(eo->pNetPool, pckt);	/* Free packet */
	END_ERR_ADD(eo, MIB2_IN_ERRS, +1);
	return;
    }

#if defined(__mips__)
    if (SOC_IS_ESW(se->se_unit)) 
    {
        seu_t *seu = &socend_seu[se->se_unit];
        void  *tmp;
	
        sal_memcpy((UINT8 *)seu->pkt_align_buf + 2, (UINT8 *)pckt, pckt_size);
	
        tmp = seu->pkt_align_buf;
        seu->pkt_align_buf = pckt;
        pckt = tmp;
    }
#endif /* __mips__ */

    /* 1 MBLK for each interface */

    if ((mb = mBlkGet(eo->pNetPool, M_DONTWAIT, MT_DATA))) {
	netClBlkJoin(cb, pckt, SOC_END_PK_SZ, NULL, 0, 0, 0);
	netMblkClJoin(mb, cb);
	mb->mBlkPktHdr.len = mb->mBlkHdr.mLen = pckt_size;
	mb->mBlkHdr.mFlags |= M_PKTHDR;
#if defined(__mips__)
        if (SOC_IS_ESW(se->se_unit)) {
            mb->mBlkHdr.mData +=2;
        }
#endif /* __mips__ */
	vid = VLAN_CTRL_ID(soc_ntohs(((enet_hdr_t *)mb->mBlkHdr.mData)->en_tag_ctrl));
        if (SOC_IS_ESW(se->se_unit)) {
            socend_untag(mb);		/* Untag packet for now */
        } else {
            robo_socend_untag(mb);		/* Untag packet for now */
        }
    } else {
	netClBlkFree(eo->pNetPool, cb);
	netClFree(eo->pNetPool, pckt);	/* Free packet */
	return;
    }

    {
	M_BLK_ID	tmb, fmb = mb;
	seu_t		*seu = &socend_seu[se->se_unit];
	/*
	 * Duplicate MBLK, and point to same cluster.
	 */
	for (se = seu->seu_devices; se != NULL; se = se->se_next) {

	    if (vid != se->se_vlan) {
		continue;
	    }

	    eo = &se->se_eo;

	    if (se->se_next != NULL) {
		tmb = mBlkGet(eo->pNetPool, M_DONTWAIT, MT_DATA);
		netMblkDup(mb, tmb);
	    } else {
		fmb = NULL;
		tmb = mb;
	    }

	    END_RCV_RTN_CALL(eo, tmb);
	}

	if (fmb) {
	    netMblkClFree(fmb);
	}
    }
}