aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/smsc95xx.c
diff options
context:
space:
mode:
authorSteve Glendinning <steve.glendinning@smsc.com>2008-12-16 05:00:48 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-16 05:00:48 -0500
commitbc02ff95fe4ebd3e5ee7455c0aa6f76ebe39ebca (patch)
tree675887b8007a53464e84b9da2f7b54a77fab035a /drivers/net/usb/smsc95xx.c
parente18ce3465477502108187c6c08b6423fb784a313 (diff)
net: Refactor full duplex flow control resolution
These 4 drivers have identical full duplex flow control resolution functions. This patch changes them all to use one common function. The function in question decides whether a device should enable TX and RX flow control in a standard way (IEEE 802.3-2005 table 28B-3), so this should also be useful for other drivers. Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/smsc95xx.c')
-rw-r--r--drivers/net/usb/smsc95xx.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index ee2eac3047b3..fed22ffedd57 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -435,28 +435,6 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
435 smsc95xx_write_reg_async(dev, MAC_CR, &pdata->mac_cr); 435 smsc95xx_write_reg_async(dev, MAC_CR, &pdata->mac_cr);
436} 436}
437 437
438static u8 smsc95xx_resolve_flowctrl_fulldplx(u16 lcladv, u16 rmtadv)
439{
440 u8 cap = 0;
441
442 if (lcladv & ADVERTISE_PAUSE_CAP) {
443 if (lcladv & ADVERTISE_PAUSE_ASYM) {
444 if (rmtadv & LPA_PAUSE_CAP)
445 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
446 else if (rmtadv & LPA_PAUSE_ASYM)
447 cap = FLOW_CTRL_RX;
448 } else {
449 if (rmtadv & LPA_PAUSE_CAP)
450 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
451 }
452 } else if (lcladv & ADVERTISE_PAUSE_ASYM) {
453 if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM))
454 cap = FLOW_CTRL_TX;
455 }
456
457 return cap;
458}
459
460static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex, 438static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
461 u16 lcladv, u16 rmtadv) 439 u16 lcladv, u16 rmtadv)
462{ 440{
@@ -469,7 +447,7 @@ static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
469 } 447 }
470 448
471 if (duplex == DUPLEX_FULL) { 449 if (duplex == DUPLEX_FULL) {
472 u8 cap = smsc95xx_resolve_flowctrl_fulldplx(lcladv, rmtadv); 450 u8 cap = mii_resolve_flowctrl_fdx(lcladv, rmtadv);
473 451
474 if (cap & FLOW_CTRL_RX) 452 if (cap & FLOW_CTRL_RX)
475 flow = 0xFFFF0002; 453 flow = 0xFFFF0002;