[PATCH v1 net] smsc95xx: Configure pause time to 0xffff when tx flow control enabled

Subsystems: networking drivers, the rest, usb networking drivers, usb smsc95xx ethernet driver

STALE3280d

3 messages, 2 authors, 2017-09-11 · open the first message on its own page

[PATCH v1 net] smsc95xx: Configure pause time to 0xffff when tx flow control enabled

From: <hidden>
Date: 2017-09-11 12:32:26

From: Nisar Sayed <redacted>

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.

Signed-off-by: Nisar Sayed <redacted>
---
v0 -> v1:
             * Added patch description in detail.
---
 drivers/net/usb/smsc95xx.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 340c134..309b88a 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;
 	}
 
-- 
1.9.1

Re: [PATCH v1 net] smsc95xx: Configure pause time to 0xffff when tx flow control enabled

From: Andrew Lunn <andrew@lunn.ch>
Date: 2017-09-11 14:02:25

On Mon, Sep 11, 2017 at 12:32:10PM +0000, Nisar.Sayed@microchip.com wrote:
From: Nisar Sayed <redacted>

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.
Hi Nisar

Thanks for the updated description. Since you are posting this for
net, not net-next, could you add a fixes: tag?

Thanks
	Andrew

RE: [PATCH v1 net] smsc95xx: Configure pause time to 0xffff when tx flow control enabled

From: <hidden>
Date: 2017-09-11 17:38:25

On Mon, Sep 11, 2017 at 12:32:10PM +0000, Nisar.Sayed@microchip.com
wrote:
quoted
From: Nisar Sayed <redacted>

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.
Hi Nisar

Thanks for the updated description. Since you are posting this for net, not
net-next, could you add a fixes: tag?

Thanks
	Andrew
Thanks Andrew, yes I will add and will submit next revision

- Nisar
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help