Data Reception
When the Ethernet device drivers receive a valid packet from the network device, the device drivers call the nd_receive function that is specified in the ndd_t structure of the network device. The nd_receive function is part of a CDLI network demultiplexer. The packet is passed to the nd_receive function in the form of a mbuf.
The Ethernet device drivers can pass multiple packets to the nd_receive function by chaining the packets together using the m_nextpkt field of the mbuf structure. The m_pkthdr.len field must be set to the total length of the packet. If the source address in the packet is a broadcast address the M_BCAST flag in the m_flags field should be set. If the source address in the packet is a multicast address the M_MCAST flag in the m_flags field should be set.
When the device driver initially configures the device to discard all invalid frames. A frame is considered to be invalid for the following reasons:
- The packet is too short.
- The packet is too long.
- The packet contains a CRC error.
- The packet contains an alignment error.
If the asynchronous status for receiving invalid frames has been issued to the device driver, the device driver configures the device to receive bad packets as well as good packets. Whenever a bad packet is received by the driver, an asynchronous status block NDD_BAD_PKTS is created and delivered to the appropriate user. The user must copy the contents of the mbuf to another memory area. The user must not modify the contents of the mbuf or free the mbuf. The device driver has the responsibility of releasing the mbuf upon returning from nd_status.
Various statistics about data reception on the device are kept by the driver in the ndd structure. These statistics are part of the data returned by the NDD_GET_STATS and NDD_GET_ALL_STATS control operations.
There is no specified entry point for this function. The device informs the device driver of a received packet using an interrupt. Upon determining that the interrupt was the result of a packet reception, the device driver's interrupt handler invoke the rx_handler completion routine to perform the tasks mentioned above.