Title: hash_fd() / unhash_fd()

When an ethernet file descriptor is configured, either the NWEO_TYPESPEC flag or the NWEO_TYPEANY flag is set for the ef_flags field of the ethernet file descriptor eth_fd, the only parameter of both hash_fd() and unhash_fd(). If NWEO_TYPEANY is set, any type of packet is accepted by the file descriptor. If NWEO_TYPESPEC if set, the nweo_type field of eth_fd is set to one of the following:

#define ETH_RARP_PROTO 0x8035
#define ETH_ARP_PROTO 0x806
#define ETH_IP_PROTO 0x800

After this configuration is done, hash_fd(eth_fd) is called to place the file descriptor in either the etp_type_any linked list (if the NWEO_TYPEANY flag is set) or in one of the linked lists in etp_type[] (there is a single linked list for each of the types shown above). Placing the file descriptors in these linked lists decreases the time needed to later find a file descriptor.

The figure below shows an example of an etp_type[] linked list with three ethernet file descriptors.

unhash_fd(eth_fd) removes the ethernet file descriptor from this linked list.