if (bcmp(mtod(m, unsigned char *), etherbroadcastaddr, 6) != 0) { 8

int ix;

LAN_FIND_MULTI(&sc->is_multi,

mtod(m, unsigned char *), ix, i); 9

if ( (i != LAN_MULTI_FOUND) 10 (sc->is_multi.lan_mtable[ix].muse == 0)) {

m_freem(m); goto scrap;

}

}

}

}

1If an mbuf was successfully allocated, copies the packet data into the mbuf (receive data are 32-bit aligned).

2Computes the length of the received data, excluding the size of the MAC header. Records this length in the mbuf header. Sets the receiving interface to be the if_el device by saving the if_el device’s ifnet data structure address in the mbuf header.

3Aligns the data pointer so that the IP header will be aligned on a 32-bit boundary. Make sure that your network driver does this also.

4Obtains the pointer to the data and calculates the number of longwords in the FIFO transfer.

5Because the EtherLink III performs no multicast filtering, if the promiscuous bit and all multicast bits are not set, determines whether any multicast addresses are actually wanted.

6Reads the first two longwords to determine whether the packet is sent to a multicast address.

7Determines whether the packet contains either a multicast or a broadcast group address.

8Because the driver receives all broadcasts, makes sure that the group address is not the broadcast address.

9Calls the LAN_FIND_MULTI macro to find the multicast address.

10

If the multicast is not found, scraps the packet.

13.2.4 Copying the Received Packet into the mbuf

The following code shows how the el_rint( ) routine copies the received packet into the mbuf:

io_blockread(sc->data, (vm_offset_t)dat, (u_long)len,

HANDLE_LONGWORD);

1

13–8Implementing the Interrupt Section

Page 146
Image 146
Compaq AA-RNG2A-TE manual Copying the Received Packet into the mbuf, 13-8Implementing the Interrupt Section