Exemplo n.º 1
0
void
at1intr(netmsg_t msg)
{
	struct mbuf *m = msg->packet.nm_packet;
	struct elaphdr *elhp, elh;

	get_mplock();

	/*
	 * Phase 1 packet handling 
	 */
	if (m->m_len < SZ_ELAPHDR && ((m = m_pullup(m, SZ_ELAPHDR)) == 0)) {
		ddpstat.ddps_tooshort++;
		goto out;
	}

	/*
	 * This seems a little dubious, but I don't know phase 1 so leave it.
	 */
	elhp = mtod(m, struct elaphdr *);
	m_adj(m, SZ_ELAPHDR);

	if (elhp->el_type == ELAP_DDPEXTEND) {
		ddp_input(m, m->m_pkthdr.rcvif, NULL, 1);
	} else {
		bcopy((caddr_t)elhp, (caddr_t)&elh, SZ_ELAPHDR);
		ddp_input(m, m->m_pkthdr.rcvif, &elh, 1);
	}
out:
	rel_mplock();
	/* msg was embedded in the mbuf, do not reply! */
}
Exemplo n.º 2
0
/*
 * Could probably merge these two code segments a little better...
 */
void
at2intr(netmsg_t msg)
{
	struct mbuf *m = msg->packet.nm_packet;

	/*
	 * Phase 2 packet handling 
	 */
	get_mplock();
	ddp_input(m, m->m_pkthdr.rcvif, NULL, 2);
	rel_mplock();
	/* msg was embedded in the mbuf, do not reply! */
}
Exemplo n.º 3
0
/*
 * Could probably merge these two code segments a little better...
 */
static void
atintr( void )
{
    struct elaphdr	*elhp, elh;
    struct ifnet	*ifp;
    struct mbuf		*m;
    int			s;

    /*
     * First pull off all the phase 2 packets.
     */
    for (;;) {
	s = splimp();

	IF_DEQUEUE( &atintrq2, m );

	splx( s );

	if ( m == 0 ) {			/* no more queued packets */
	    break;
	}

	ifp = m->m_pkthdr.rcvif;
	ddp_input( m, ifp, (struct elaphdr *)NULL, 2 );
    }

    /*
     * Then pull off all the phase 1 packets.
     */
    for (;;) {
	s = splimp();

	IF_DEQUEUE( &atintrq1, m );

	splx( s );

	if ( m == 0 ) {			/* no more queued packets */
	    break;
	}

	ifp = m->m_pkthdr.rcvif;

	if ( m->m_len < SZ_ELAPHDR &&
		(( m = m_pullup( m, SZ_ELAPHDR )) == 0 )) {
	    ddpstat.ddps_tooshort++;
	    continue;
	}

	/*
	 * this seems a little dubios, but I don't know phase 1 so leave it.
	 */
	elhp = mtod( m, struct elaphdr *);
	m_adj( m, SZ_ELAPHDR );

	if ( elhp->el_type == ELAP_DDPEXTEND ) {
	    ddp_input( m, ifp, (struct elaphdr *)NULL, 1 );
	} else {
	    bcopy((caddr_t)elhp, (caddr_t)&elh, SZ_ELAPHDR );
	    ddp_input( m, ifp, &elh, 1 );
	}
    }
    return;
}
Exemplo n.º 4
0
/*
 * Could probably merge these two code segments a little better...
 */
void
atintr()
{
    struct elaphdr	*elhp, elh;
    struct ifnet	*ifp;
    struct mbuf		*m;
    struct at_ifaddr	*aa;
    int			s;

    for (;;) {
	s = splimp();

	IF_DEQUEUE( &atintrq2, m );

	splx( s );

	if ( m == 0 ) {			/* no more queued packets */
	    break;
	}

	ifp = m->m_pkthdr.rcvif;
	for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
	    if ( aa->aa_ifp == ifp && ( aa->aa_flags & AFA_PHASE2 )) {
		break;
	    }
	}
	if ( aa == NULL ) {		/* ifp not an appletalk interface */
	    m_freem( m );
	    continue;
	}

	ddp_input( m, ifp, (struct elaphdr *)NULL, 2 );
    }

    for (;;) {
	s = splimp();

	IF_DEQUEUE( &atintrq1, m );

	splx( s );

	if ( m == 0 ) {			/* no more queued packets */
	    break;
	}

	ifp = m->m_pkthdr.rcvif;
	for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
	    if ( aa->aa_ifp == ifp && ( aa->aa_flags & AFA_PHASE2 ) == 0 ) {
		break;
	    }
	}
	if ( aa == NULL ) {		/* ifp not an appletalk interface */
	    m_freem( m );
	    continue;
	}

	if ( m->m_len < SZ_ELAPHDR &&
		(( m = m_pullup( m, SZ_ELAPHDR )) == 0 )) {
	    ddpstat.ddps_tooshort++;
	    continue;
	}

	elhp = mtod( m, struct elaphdr *);
	m_adj( m, SZ_ELAPHDR );

	if ( elhp->el_type == ELAP_DDPEXTEND ) {
	    ddp_input( m, ifp, (struct elaphdr *)NULL, 1 );
	} else {
	    bcopy((caddr_t)elhp, (caddr_t)&elh, SZ_ELAPHDR );
	    ddp_input( m, ifp, &elh, 1 );
	}
    }
    return;
}