On Wed, 28 Dec 2005, Dale Farnsworth wrote:
> From: Dale Farnsworth <[EMAIL PROTECTED]>
>
> Add multicast support the the Marvell mv643xx ethernet driver.
>
> This code is adapted from code in a ppc-specific version of the driver.
>
> Signed-off-by: Dale Farnsworth <[EMAIL PROTECTED]>
>
> Index: linux-2.6-mv643xx_enet.git/drivers/net/mv643xx_eth.c
> ===================================================================
> --- linux-2.6-mv643xx_enet.git.orig/drivers/net/mv643xx_eth.c
> +++ linux-2.6-mv643xx_enet.git/drivers/net/mv643xx_eth.c
> +
> +/*******************************************************************************
> +* eth_port_mc_addr - Multicast address settings.
> +*
> +* DESCRIPTION:
> +* This function controls the MV device MAC multicast support.
> +* The MV device supports multicast using two tables:
> +* 1) Special Multicast Table for MAC addresses of the form
> +* 0x01-00-5E-00-00-XX (where XX is between 0x00 and 0x_FF).
Just FMI (for my info), what are the semantics of the Special
Multicast Table? Is this done in conformance with some RFC or
other "standard"? Thanks.
> +* The MAC DA[7:0] bits are used as a pointer to the Special Multicast
> +* Table entries in the DA-Filter table.
> +* 2) Other Multicast Table for multicast of another type. A CRC-8bit
> +* is used as an index to the Other Multicast Table entries in the
> +* DA-Filter table. This function calculates the CRC-8bit value.
> +* In either case, eth_port_set_filter_table_entry() is then called
> +* to set to set the actual table entry.
> +* INPUT:
> +* unsigned int eth_port_num Port number.
> +* unsigned char *p_addr Unicast MAC Address.
> +*
> +* OUTPUT:
> +* See description.
> +*
> +* RETURN:
> +* None.
> +*
> +*******************************************************************************/
Please use kernel-doc style function comment blocks.
See Documentation/kernel-doc-nano-HOWTO.txt .
> +static void eth_port_mc_addr(unsigned int eth_port_num, unsigned char
> *p_addr)
> +{
> +}
> +/** Set the entire multicast list base on dev->mc_list. **/
s/base/based/ ??
> +static void eth_port_set_multicast_list(struct net_device *dev)
> +{
> +
> + struct dev_mc_list *mc_list;
> + int i;
> + int table_index;
> + struct mv643xx_private *mp = netdev_priv(dev);
> + unsigned int eth_port_num = mp->port_num;
> +
> + /** If the device is in promiscuous mode or in all multicast mode,
> + ** we will fully populate both multicast tables with accept.
> + ** This is guaranteed to yield a match on all multicast addresses...
> + **/
Not quite Linux kernel long comment style (use just one '*').
(above and below)
> + if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) {
> + for (table_index = 0; table_index <= 0xFC; table_index += 4) {
> + /** Set all entries in DA filter special multicast
> + ** table (Ex_dFSMT)
> + ** Set for ETH_Q0 for now
> + ** Bits
> + ** 0 Accept=1, Drop=0
> + ** 3-1 Queue ETH_Q0=0
> + ** 7-4 Reserved = 0;
> + **/
> +
> mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) +
> table_index, 0x01010101);
> +
> + /** Set all entries in DA filter other multicast
> + ** table (Ex_dFOMT)
> + ** Set for ETH_Q0 for now
> + ** Bits
> + ** 0 Accept=1, Drop=0
> + ** 3-1 Queue ETH_Q0=0
> + ** 7-4 Reserved = 0;
> + **/
> +
> mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) +
> table_index, 0x01010101);
> + }
> + return;
> + }
> +
> + /** We will clear out multicast tables everytime we get the list.
s/everytime/every time/
> + ** Then add the entire new list...
> + **/
> + for (table_index = 0; table_index <= 0xFC; table_index += 4) {
> + /* Clear DA filter special multicast table (Ex_dFSMT) */
> + mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE
> + (eth_port_num) + table_index, 0);
> +
> + /* Clear DA filter other multicast table (Ex_dFOMT) */
> + mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE
> + (eth_port_num) + table_index, 0);
> + }
> +
> + /** Get pointer to net_device multicast list and add each one... **/
> + for(i = 0, mc_list = dev->mc_list;
Space after "for".
> + (i < 256) && (mc_list != NULL) && (i < dev->mc_count);
> + i++, mc_list = mc_list->next)
> + if (mc_list->dmi_addrlen == 6)
> + eth_port_mc_addr(eth_port_num, mc_list->dmi_addr);
> +}
> +
--
~Randy
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html