SMSC LAN1198 User Manual

Page of 45
LAN9118 Family Programmer Reference Guide
Revision 1.0 (12-14-09)
18
SMSC AN 12.12
APPLICATION NOTE
 
5.5   Configuring Address Filtering Options
 shows the relations between the control flags which affect the
address filter mode.
5.5.1   Configuring Multicast Filtering
Multicast applications act very much like broadcast radio, where all receivers attuned to one station
receive the same programming.  Multicast packets are a type of broadcast packet, but require filtering
to be received by the intended audience.
The hash filtering works by identifying incoming packets with a 48-bit destination multicast MAC
addresses, those addresses having a leading bit pattern of 01:00:5e:xx:yy:zz, running only the
destination MAC address through a hash (actually it’s the CRC32 algorithm, taking the result of the
first 6 bytes of the incoming packet and extracting from that the high 6-bits), resulting in a 6-bit (1-of-
64) value, which is used to index a 64 x 1-bit array contained across the MAC HASHH:HASHL register
pair (from bit 0 of HASHL:0 on up through bit 31 of HASHH:63).  If the bit indexed by the hash is a
‘1’, it is considered to be a match, and the entire packet is brought into the device for perfect multicast
address filtering in software.
At startup the hash filter is cleared.  As the driver accepts requests to join multicast sessions, the driver
must add the multicast address to its perfect filter table in software.  Then it must calculate the
appropriate bit to set in the hash array and update the devices’ HASHH:HASHL register pair.  When
the application leaves the multicast session, the driver must update the filter table and the
HASHH:HASHL register pair appropriately.
5.5.2   Promiscuous Mode
Some applications need to examine every single packet traversing the LAN, whether the packet
destination MAC address is broadcast or not, and whether the packet data regards the host in question
or not.  Communally these programs are referred to as “packet sniffers”.  An example is the Ethereal
program, available for a wide range of operating systems (
).  At the heart of
these programs is the requirement for the LAN device driver to receive every packet on the LAN.
The term for receiving every packet on the LAN is called Promiscuous Mode, and it is supported by
all LAN9118 Family members.  To enable Promiscuous Mode, set the MAC_CR:PRMS bit to a ‘1’ and
reset the MAC_CR:INVFLT bit to’0’.
Table 5.2  Address Filtering Modes
MCPAS
PRMS
INVFILT
HFILT
HPFILT
DESCRIPTION
0
0
0
0
0
MAC Address Perfect filtering only for 
all addresses.
0
0
0
0
1
MAC Address Perfect filtering for 
physical address and Hash filtering for 
multicast addresses
0
0
0
1
1
Hash Filtering for physical and 
multicast addresses
0
0
1
0
0
Inverse Filtering
X
1
0
X
X
Promiscuous
1
0
0
0
X
Pass all multicast frames. Frames with 
physical addresses are perfect-filtered
1
0
0
1
1
Pass all multicast frames. Frames with 
physical addresses are hash-filtered