Commit 7342cd810cfd73120687d5323846e5c114cb23bb
Committed by
Jeff Garzik
1 parent
8f543718ea
Exists in
master
and in
39 other branches
[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>
Showing 2 changed files with 4 additions and 62 deletions Side-by-side Diff
drivers/net/mv643xx_eth.c
... | ... | @@ -259,14 +259,13 @@ |
259 | 259 | static void mv643xx_eth_set_rx_mode(struct net_device *dev) |
260 | 260 | { |
261 | 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 | 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 | 265 | else |
268 | - config_reg &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; | |
269 | - ethernet_set_config_reg(mp->port_num, config_reg); | |
266 | + mp->port_config &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE; | |
267 | + | |
268 | + mv_write(MV643XX_ETH_PORT_CONFIG_REG(mp->port_num), mp->port_config); | |
270 | 269 | } |
271 | 270 | |
272 | 271 | /* |
273 | 272 | |
... | ... | @@ -2278,35 +2277,7 @@ |
2278 | 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 | - */ | |
2300 | -static void ethernet_set_config_reg(unsigned int eth_port_num, | |
2301 | - unsigned int value) | |
2302 | -{ | |
2303 | - unsigned int eth_config_reg; | |
2304 | 2280 | |
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 | - | |
2310 | 2281 | static int eth_port_autoneg_supported(unsigned int eth_port_num) |
2311 | 2282 | { |
2312 | 2283 | unsigned int phy_reg_data0; |
... | ... | @@ -2329,31 +2300,6 @@ |
2329 | 2300 | return 1; |
2330 | 2301 | |
2331 | 2302 | return 0; |
2332 | -} | |
2333 | - | |
2334 | -/* | |
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 | - */ | |
2350 | -static 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 | 2303 | } |
2358 | 2304 | |
2359 | 2305 | /* |
drivers/net/mv643xx_eth.h
... | ... | @@ -408,10 +408,6 @@ |
408 | 408 | static void eth_port_reset(unsigned int eth_port_num); |
409 | 409 | static void eth_port_start(struct mv643xx_private *mp); |
410 | 410 | |
411 | -static void ethernet_set_config_reg(unsigned int eth_port_num, | |
412 | - unsigned int value); | |
413 | -static unsigned int ethernet_get_config_reg(unsigned int eth_port_num); | |
414 | - | |
415 | 411 | /* Port MAC address routines */ |
416 | 412 | static void eth_port_uc_addr_set(unsigned int eth_port_num, |
417 | 413 | unsigned char *p_addr); |