Esempio n. 1
0
void 
check_common(dbref obj)
{
    printf("\nObject %s\n", unparse_object(me, obj));
    printf("Name: %s\n", uncompress(DBFETCH(obj)->name));
    if (GETDESC(obj))
	printf("Desc: %s\n", uncompress(GETDESC(obj)));
    printf("Loc: #%s\n", unparse_object(me, DBFETCH(obj)->location));
    printf("Owner: #%d\n", unparse_object(me, DBFETCH(obj)->owner));
    printf("First contents: #%d\n", unparse_object(me, DBFETCH(obj)->contents));
    printf("Next item: #%d\n", unparse_object(me, DBFETCH(obj)->next));
    printf("Key: %s\n", unparse_boolexp(me, GETLOCK(obj)), 1);
    if (GETFAIL(obj))
	printf("Fail: %s\n", uncompress(GETFAIL(obj)));
    if (GETSUCC(obj))
	printf("Succ: %s\n", uncompress(GETSUCC(obj)));
    if (GETDROP(obj))
	printf("Drop: %s\n", uncompress(GETDROP(obj)));
    if (GETOFAIL(obj))
	printf("Ofail: %s\n", uncompress(GETOFAIL(obj)));
    if (GETOSUCC(obj))
	printf("Osucc: %s\n", uncompress(GETOSUCC(obj)));
    if (GETODROP(obj))
	printf("Odrop: %s\n", uncompress(GETODROP(obj)));
    printf("Properties:\n");
    check_properties("/", obj);
    printf("End of properties.\n");
}
Esempio n. 2
0
void
efe_init_tx_ring(efe_t *efep)
{
	efe_ring_t *rp;

	ASSERT(mutex_owned(&efep->efe_txlock));

	rp = efep->efe_tx_ring;

	for (int i = 0; i < DESCLEN(rp); ++i) {
		efe_desc_t *dp = GETDESC(rp, i);
		efe_buf_t *bp = GETBUF(rp, i);

		PUTDESC16(rp, &dp->d_status, 0);
		PUTDESC16(rp, &dp->d_len, 0);
		PUTDESC32(rp, &dp->d_bufaddr, BUFADDR(bp));
		PUTDESC16(rp, &dp->d_buflen, BUFLEN(bp));
		PUTDESC16(rp, &dp->d_control, 0);
		PUTDESC32(rp, &dp->d_next, NEXTDESCADDR(rp, i));

		SYNCDESC(rp, i, DDI_DMA_SYNC_FORDEV);
	}

	efep->efe_tx_desc = 0;
	efep->efe_tx_sent = 0;

	PUTCSR(efep, CSR_PTCDAR, DESCADDR(rp, 0));
}
Esempio n. 3
0
void
efe_send_done(efe_t *efep)
{
	efe_ring_t *rp;

	ASSERT(mutex_owned(&efep->efe_txlock));

	rp = efep->efe_tx_ring;

	for (;;) {
		efe_desc_t *dp;
		uint16_t status;

		dp = GETDESC(rp, efep->efe_tx_sent);
		SYNCDESC(rp, efep->efe_tx_sent, DDI_DMA_SYNC_FORKERNEL);

		status = GETDESC16(rp, &dp->d_status);

		/* Stop if device owns descriptor */
		if (status & TXSTAT_OWNER) {
			break;
		}

		if (status & TXSTAT_PTX) {
			if (!(status & TXSTAT_ND)) {
				efep->efe_defer_xmts++;
			}
			if (status & TXSTAT_COLL) {
				efep->efe_first_collisions++;
			}

		} else {
			efep->efe_oerrors++;

			if (status & TXSTAT_CSL) {
				efep->efe_carrier_errors++;
			}
			if (status & TXSTAT_UFLO) {
				efep->efe_uflo++;
			}
			if (status & TXSTAT_OWC) {
				efep->efe_tx_late_collisions++;
			}
			if (status & TXSTAT_DEFER) {
				efep->efe_jabber_errors++;
			}
			if (status & TXSTAT_EXCOLL) {
				efep->efe_ex_collisions++;
			}
		}

		efep->efe_collisions +=
		    (status >> TXSTAT_CCNT) & TXSTAT_CCNTMASK;

		efep->efe_tx_sent = NEXTDESC(rp, efep->efe_tx_sent);
	}
}
Esempio n. 4
0
mblk_t *
efe_recv(efe_t *efep)
{
	efe_ring_t *rp;
	mblk_t *mp = NULL;
	mblk_t **mpp = &mp;

	ASSERT(mutex_owned(&efep->efe_intrlock));

	rp = efep->efe_rx_ring;

	for (;;) {
		efe_desc_t *dp;
		uint16_t status;

		dp = GETDESC(rp, efep->efe_rx_desc);
		SYNCDESC(rp, efep->efe_rx_desc, DDI_DMA_SYNC_FORKERNEL);

		status = GETDESC16(rp, &dp->d_status);

		/* Stop if device owns descriptor */
		if (status & RXSTAT_OWNER) {
			break;
		}

		if (status & RXSTAT_PRI) {
			mblk_t *tmp = efe_recv_pkt(efep, dp);
			if (tmp != NULL) {
				*mpp = tmp;
				mpp = &tmp->b_next;
			}

		} else {
			efep->efe_ierrors++;

			if (status & RXSTAT_FAE) {
				efep->efe_align_errors++;
			}
			if (status & RXSTAT_CRC) {
				efep->efe_fcs_errors++;
			}
			if (status & RXSTAT_MP) {
				efep->efe_oflo++;
			}
		}

		/* Release ownership to device */
		PUTDESC16(rp, &dp->d_status, RXSTAT_OWNER);

		SYNCDESC(rp, efep->efe_rx_desc, DDI_DMA_SYNC_FORDEV);

		efep->efe_rx_desc = NEXTDESC(rp, efep->efe_rx_desc);
	}

	return (mp);
}
Esempio n. 5
0
int
efe_send(efe_t *efep, mblk_t *mp)
{
	efe_ring_t *rp;
	uint16_t len;
	efe_desc_t *dp;
	uint16_t status;
	efe_buf_t *bp;

	ASSERT(mutex_owned(&efep->efe_txlock));

	rp = efep->efe_tx_ring;

	len = msgsize(mp);

	if (len > ETHERMAX + VLAN_TAGSZ) {
		efep->efe_oerrors++;
		efep->efe_macxmt_errors++;
		freemsg(mp);
		return (DDI_SUCCESS);
	}

	dp = GETDESC(rp, efep->efe_tx_desc);
	SYNCDESC(rp, efep->efe_tx_desc, DDI_DMA_SYNC_FORKERNEL);

	status = GETDESC16(efep->efe_tx_ring, &dp->d_status);

	/* Stop if device owns descriptor */
	if (status & TXSTAT_OWNER) {
		return (DDI_FAILURE);
	}

	bp = GETBUF(rp, efep->efe_tx_desc);

	mcopymsg(mp, bp->b_kaddr);

	/*
	 * Packets must contain at least ETHERMIN octets.
	 * Padded octets are zeroed out prior to sending.
	 */
	if (len < ETHERMIN) {
		bzero(bp->b_kaddr + len, ETHERMIN - len);
		len = ETHERMIN;
	}

	SYNCBUF(bp, DDI_DMA_SYNC_FORDEV);

	PUTDESC16(rp, &dp->d_status, TXSTAT_OWNER);
	PUTDESC16(rp, &dp->d_len, len);
	PUTDESC16(rp, &dp->d_control, TXCTL_LASTDESCR);

	SYNCDESC(rp, efep->efe_tx_desc, DDI_DMA_SYNC_FORDEV);

	efep->efe_opackets++;
	efep->efe_obytes += len;

	if (*bp->b_kaddr & 0x01) {
		if (bcmp(bp->b_kaddr, efe_broadcast, ETHERADDRL) == 0) {
			efep->efe_brdcstxmt++;
		} else {
			efep->efe_multixmt++;
		}
	}

	efep->efe_tx_desc = NEXTDESC(rp, efep->efe_tx_desc);

	return (DDI_SUCCESS);
}