diff mbox

[2/2] net: qcom/emac: enable flow control if requested

Message ID 1478025055-13167-2-git-send-email-timur@codeaurora.org
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Timur Tabi Nov. 1, 2016, 6:30 p.m. UTC
If the PHY has been configured to allow pause frames, then the MAC
should be configured to generate and/or accept those frames.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
 drivers/net/ethernet/qualcomm/emac/emac-mac.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Florian Fainelli Nov. 1, 2016, 6:34 p.m. UTC | #1
On 11/01/2016 11:30 AM, Timur Tabi wrote:
> If the PHY has been configured to allow pause frames, then the MAC
> should be configured to generate and/or accept those frames.
> 
> Signed-off-by: Timur Tabi <timur@codeaurora.org>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Timur Tabi Nov. 1, 2016, 7:05 p.m. UTC | #2
On 11/01/2016 01:30 PM, Timur Tabi wrote:
> +	if (!phydev->pause && phydev->asym_pause)
> +		mac |= TXFC;

I think this might be wrong, and nb8800_pause_config() has it right. 
This should be:

	if (!phydev->pause != !phydev->asym_pause)

which is a logical-xor.

Do you concur?
diff mbox

Patch

diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index 70a55dc..46e19e9 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -575,10 +575,12 @@  void emac_mac_start(struct emac_adapter *adpt)
 
 	mac |= TXEN | RXEN;     /* enable RX/TX */
 
-	/* We don't have ethtool support yet, so force flow-control mode
-	 * to 'full' always.
-	 */
-	mac |= TXFC | RXFC;
+	/* Configure MAC flow control to patch the PHY's settings */
+	if (phydev->pause)
+		mac |= RXFC;
+
+	if (!phydev->pause && phydev->asym_pause)
+		mac |= TXFC;
 
 	/* setup link speed */
 	mac &= ~SPEED_MASK;