All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@codeaurora.org>
To: David Miller <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	alokc@codeaurora.org, netdev@vger.kernel.org
Subject: [PATCH 2/2] [v2] net: qcom/emac: enable flow control if requested
Date: Mon,  7 Nov 2016 10:51:41 -0600	[thread overview]
Message-ID: <1478537501-23454-3-git-send-email-timur@codeaurora.org> (raw)
In-Reply-To: <1478537501-23454-1-git-send-email-timur@codeaurora.org>

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>
---

v2: fix calculation when TXFC should be set

 drivers/net/ethernet/qualcomm/emac/emac-mac.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index 70a55dc..0b4deb3 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -575,10 +575,11 @@ 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 match the PHY's settings. */
+	if (phydev->pause)
+		mac |= RXFC;
+	if (phydev->pause != phydev->asym_pause)
+		mac |= TXFC;
 
 	/* setup link speed */
 	mac &= ~SPEED_MASK;
-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  parent reply	other threads:[~2016-11-07 16:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 16:51 [PATCH 0/2] net: qcom/emac: ensure that pause frames are enabled Timur Tabi
2016-11-07 16:51 ` [PATCH 1/2] net: qcom/emac: configure the external phy to allow pause frames Timur Tabi
2016-11-07 16:51 ` Timur Tabi [this message]
2016-11-09 23:45 ` [PATCH 0/2] net: qcom/emac: ensure that pause frames are enabled David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478537501-23454-3-git-send-email-timur@codeaurora.org \
    --to=timur@codeaurora.org \
    --cc=alokc@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.