summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNisar Sayed <Nisar.Sayed@microchip.com>2017-09-11 17:43:11 +0000
committerDavid S. Miller <davem@davemloft.net>2017-09-12 20:36:30 -0700
commit9c0827317f235865ae421293f8aecf6cb327a63e (patch)
tree0e25b5b31a5754557f8d50aadd5025a99a6d43ec
parent230cfd2dbc228a6992287d31c5d93bc6c2552024 (diff)
downloadlinux-stable-9c0827317f235865ae421293f8aecf6cb327a63e.tar.gz
linux-stable-9c0827317f235865ae421293f8aecf6cb327a63e.tar.bz2
linux-stable-9c0827317f235865ae421293f8aecf6cb327a63e.zip
smsc95xx: Configure pause time to 0xffff when tx flow control enabled
Configure pause time to 0xffff when tx flow control enabled Set pause time to 0xffff in the pause frame to indicate the partner to stop sending the packets. When RX buffer frees up, the device sends pause frame with pause time zero for partner to resume transmission. Fixes: 2f7ca802bdae ("Add SMSC LAN9500 USB2.0 10/100 ethernet adapter driver") Signed-off-by: Nisar Sayed <Nisar.Sayed@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/smsc95xx.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 340c13484e5c..309b88acd3d0 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -526,7 +526,7 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
static int smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
u16 lcladv, u16 rmtadv)
{
- u32 flow, afc_cfg = 0;
+ u32 flow = 0, afc_cfg;
int ret = smsc95xx_read_reg(dev, AFC_CFG, &afc_cfg);
if (ret < 0)
@@ -537,20 +537,19 @@ static int smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
if (cap & FLOW_CTRL_RX)
flow = 0xFFFF0002;
- else
- flow = 0;
- if (cap & FLOW_CTRL_TX)
+ if (cap & FLOW_CTRL_TX) {
afc_cfg |= 0xF;
- else
+ flow |= 0xFFFF0000;
+ } else {
afc_cfg &= ~0xF;
+ }
netif_dbg(dev, link, dev->net, "rx pause %s, tx pause %s\n",
cap & FLOW_CTRL_RX ? "enabled" : "disabled",
cap & FLOW_CTRL_TX ? "enabled" : "disabled");
} else {
netif_dbg(dev, link, dev->net, "half duplex\n");
- flow = 0;
afc_cfg |= 0xF;
}