Skip to content

Commit

Permalink
[PATCH] mv643xx: Fix promiscuous mode handling
Browse files Browse the repository at this point in the history
mv643xx_eth_get_config_reg() was reading the wrong register.
mv643xx_eth_set_config_reg() was or'ing instead of setting the
register.  These functions are trivial and both are called only from
mv643xx_eth_set_rx_mode() when changing to/from promiscuous mode.
Remove both functions and do the operations directly in
mv643xx_eth_set_rx_mode().

Also, maintain promiscuous mode setting across port resets.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
  • Loading branch information
Dale Farnsworth authored and Jeff Garzik committed Sep 5, 2005
1 parent 8f54371 commit 7342cd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 62 deletions.
62 changes: 4 additions & 58 deletions drivers/net/mv643xx_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,13 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
static void mv643xx_eth_set_rx_mode(struct net_device *dev)
{
struct mv643xx_private *mp = netdev_priv(dev);
u32 config_reg;

config_reg = ethernet_get_config_reg(mp->port_num);
if (dev->flags & IFF_PROMISC)
config_reg |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
mp->port_config |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
else
config_reg &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
ethernet_set_config_reg(mp->port_num, config_reg);
mp->port_config &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;

mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), mp->port_config);
}

/*
Expand Down Expand Up @@ -2278,34 +2277,6 @@ static void eth_port_reset(unsigned int port_num)
mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_data);
}

/*
* ethernet_set_config_reg - Set specified bits in configuration register.
*
* DESCRIPTION:
* This function sets specified bits in the given ethernet
* configuration register.
*
* INPUT:
* unsigned int eth_port_num Ethernet Port number.
* unsigned int value 32 bit value.
*
* OUTPUT:
* The set bits in the value parameter are set in the configuration
* register.
*
* RETURN:
* None.
*
*/
static void ethernet_set_config_reg(unsigned int eth_port_num,
unsigned int value)
{
unsigned int eth_config_reg;

eth_config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_REG(eth_port_num));
eth_config_reg |= value;
mv_write(MV643XX_ETH_PORT_CONFIG_REG(eth_port_num), eth_config_reg);
}

static int eth_port_autoneg_supported(unsigned int eth_port_num)
{
Expand All @@ -2331,31 +2302,6 @@ static int eth_port_link_is_up(unsigned int eth_port_num)
return 0;
}

/*
* ethernet_get_config_reg - Get the port configuration register
*
* DESCRIPTION:
* This function returns the configuration register value of the given
* ethernet port.
*
* INPUT:
* unsigned int eth_port_num Ethernet Port number.
*
* OUTPUT:
* None.
*
* RETURN:
* Port configuration register value.
*/
static unsigned int ethernet_get_config_reg(unsigned int eth_port_num)
{
unsigned int eth_config_reg;

eth_config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_EXTEND_REG
(eth_port_num));
return eth_config_reg;
}

/*
* eth_port_read_smi_reg - Read PHY registers
*
Expand Down
4 changes: 0 additions & 4 deletions drivers/net/mv643xx_eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,6 @@ static void eth_port_init(struct mv643xx_private *mp);
static void eth_port_reset(unsigned int eth_port_num);
static void eth_port_start(struct mv643xx_private *mp);

static void ethernet_set_config_reg(unsigned int eth_port_num,
unsigned int value);
static unsigned int ethernet_get_config_reg(unsigned int eth_port_num);

/* Port MAC address routines */
static void eth_port_uc_addr_set(unsigned int eth_port_num,
unsigned char *p_addr);
Expand Down

0 comments on commit 7342cd8

Please sign in to comment.