Copying The Received Packet Into The Mbuf - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

}
If an mbuf was successfully allocated, copies the packet data into the
1
mbuf (receive data are 32-bit aligned).
Computes the length of the received data, excluding the size of the MAC
2
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.
Aligns the data pointer so that the IP header will be aligned on a 32-bit
3
boundary. Make sure that your network driver does this also.
Obtains the pointer to the data and calculates the number of longwords
4
in the FIFO transfer.
Because the EtherLink III performs no multicast filtering, if the
5
promiscuous bit and all multicast bits are not set, determines whether
any multicast addresses are actually wanted.
Reads the first two longwords to determine whether the packet is sent
6
to a multicast address.
Determines whether the packet contains either a multicast or a
7
broadcast group address.
Because the driver receives all broadcasts, makes sure that the group
8
address is not the broadcast address.
Calls the LAN_FIND_MULTI macro to find the multicast address.
9
If the multicast is not found, scraps the packet.
10

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,
13–8 Implementing the Interrupt Section
if (bcmp(mtod(m, unsigned char *),
etherbroadcastaddr, 6) != 0) {
int ix;
LAN_FIND_MULTI(&sc->is_multi,
mtod(m, unsigned char *),
ix, i);
if ( (i != LAN_MULTI_FOUND) ||
(sc->is_multi.lan_mtable[ix].muse == 0)) {
m_freem(m);
goto scrap;
}
}
}
(vm_offset_t)dat,
(u_long)len,
HANDLE_LONGWORD);
8
9
10
1

Advertisement

Table of Contents
loading

Table of Contents