aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Farnsworth <dale@farnsworth.org>2005-09-02 15:36:48 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-05 18:08:30 -0400
commit7342cd810cfd73120687d5323846e5c114cb23bb (patch)
tree60106923617dae852111129609bc68e6b4be3aeb
parent8f543718ea1c20795853bf065f1dcb510f210465 (diff)
[PATCH] mv643xx: Fix promiscuous mode handling
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>
-rw-r--r--drivers/net/mv643xx_eth.c62
-rw-r--r--drivers/net/mv643xx_eth.h4
2 files changed, 4 insertions, 62 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 25a094c44f39..bb230e6c197b 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -259,14 +259,13 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
259static void mv643xx_eth_set_rx_mode(struct net_device *dev) 259static void mv643xx_eth_set_rx_mode(struct net_device *dev)
260{ 260{
261 struct mv643xx_private *mp = netdev_priv(dev); 261 struct mv643xx_private *mp = netdev_priv(dev);
262 u32 config_reg;
263 262
264 config_reg = ethernet_get_config_reg(mp->port_num);
265 if (dev->flags & IFF_PROMISC) 263 if (dev->flags & IFF_PROMISC)
266 config_reg |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; 264 mp->port_config |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
267 else 265 else
268 config_reg &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; 266 mp->port_config &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
269 ethernet_set_config_reg(mp->port_num, config_reg); 267
268 mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), mp->port_config);
270} 269}
271 270
272/* 271/*
@@ -2278,34 +2277,6 @@ static void eth_port_reset(unsigned int port_num)
2278 mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_data); 2277 mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_data);
2279} 2278}
2280 2279
2281/*
2282 * ethernet_set_config_reg - Set specified bits in configuration register.
2283 *
2284 * DESCRIPTION:
2285 * This function sets specified bits in the given ethernet
2286 * configuration register.
2287 *
2288 * INPUT:
2289 * unsigned int eth_port_num Ethernet Port number.
2290 * unsigned int value 32 bit value.
2291 *
2292 * OUTPUT:
2293 * The set bits in the value parameter are set in the configuration
2294 * register.
2295 *
2296 * RETURN:
2297 * None.
2298 *
2299 */
2300static void ethernet_set_config_reg(unsigned int eth_port_num,
2301 unsigned int value)
2302{
2303 unsigned int eth_config_reg;
2304
2305 eth_config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_REG(eth_port_num));
2306 eth_config_reg |= value;
2307 mv_write(MV643XX_ETH_PORT_CONFIG_REG(eth_port_num), eth_config_reg);
2308}
2309 2280
2310static int eth_port_autoneg_supported(unsigned int eth_port_num) 2281static int eth_port_autoneg_supported(unsigned int eth_port_num)
2311{ 2282{
@@ -2332,31 +2303,6 @@ static int eth_port_link_is_up(unsigned int eth_port_num)
2332} 2303}
2333 2304
2334/* 2305/*
2335 * ethernet_get_config_reg - Get the port configuration register
2336 *
2337 * DESCRIPTION:
2338 * This function returns the configuration register value of the given
2339 * ethernet port.
2340 *
2341 * INPUT:
2342 * unsigned int eth_port_num Ethernet Port number.
2343 *
2344 * OUTPUT:
2345 * None.
2346 *
2347 * RETURN:
2348 * Port configuration register value.
2349 */
2350static unsigned int ethernet_get_config_reg(unsigned int eth_port_num)
2351{
2352 unsigned int eth_config_reg;
2353
2354 eth_config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_EXTEND_REG
2355 (eth_port_num));
2356 return eth_config_reg;
2357}
2358
2359/*
2360 * eth_port_read_smi_reg - Read PHY registers 2306 * eth_port_read_smi_reg - Read PHY registers
2361 * 2307 *
2362 * DESCRIPTION: 2308 * DESCRIPTION:
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h
index 7678b59c2952..bcfda5192da0 100644
--- a/drivers/net/mv643xx_eth.h
+++ b/drivers/net/mv643xx_eth.h
@@ -408,10 +408,6 @@ static void eth_port_init(struct mv643xx_private *mp);
408static void eth_port_reset(unsigned int eth_port_num); 408static void eth_port_reset(unsigned int eth_port_num);
409static void eth_port_start(struct mv643xx_private *mp); 409static void eth_port_start(struct mv643xx_private *mp);
410 410
411static void ethernet_set_config_reg(unsigned int eth_port_num,
412 unsigned int value);
413static unsigned int ethernet_get_config_reg(unsigned int eth_port_num);
414
415/* Port MAC address routines */ 411/* Port MAC address routines */
416static void eth_port_uc_addr_set(unsigned int eth_port_num, 412static void eth_port_uc_addr_set(unsigned int eth_port_num,
417 unsigned char *p_addr); 413 unsigned char *p_addr);