linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
To: mugunthanvnm@ti.com, grygorii.strashko@ti.com
Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Subject: [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode
Date: Sat, 10 Dec 2016 14:23:50 +0200	[thread overview]
Message-ID: <1481372630-14914-6-git-send-email-ivan.khoronzhuk@linaro.org> (raw)
In-Reply-To: <1481372630-14914-1-git-send-email-ivan.khoronzhuk@linaro.org>

The channels are common for both ndevs in dual emac mode. Hence, keep
in sync their rates.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 drivers/net/ethernet/ti/cpsw.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 7ccfa63..b203143 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2020,9 +2020,10 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
 {
 	struct cpsw_priv *priv = netdev_priv(ndev);
 	struct cpsw_common *cpsw = priv->cpsw;
+	struct cpsw_slave *slave;
 	u32 min_rate;
 	u32 ch_rate;
-	int ret;
+	int i, ret;
 
 	ch_rate = netdev_get_tx_queue(ndev, queue)->tx_maxrate;
 	if (ch_rate == rate)
@@ -2053,6 +2054,15 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
 	if (ret)
 		return ret;
 
+	/* update rates for slaves tx queues */
+	for (i = 0; i < cpsw->data.slaves; i++) {
+		slave = &cpsw->slaves[i];
+		if (!slave->ndev)
+			continue;
+
+		netdev_get_tx_queue(slave->ndev, queue)->tx_maxrate = rate;
+	}
+
 	cpsw_split_res(ndev);
 	return ret;
 }
-- 
2.7.4

  parent reply	other threads:[~2016-12-10 12:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-10 12:23 [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy Ivan Khoronzhuk
2016-12-10 12:23 ` [PATCH 1/5] net: ethernet: ti: cpsw: use same macros to get active slave Ivan Khoronzhuk
2016-12-10 12:23 ` [PATCH 2/5] net: ethernet: ti: cpsw: don't start queue twice Ivan Khoronzhuk
2016-12-10 22:30   ` David Miller
2016-12-10 12:23 ` [PATCH 3/5] net: ethernet: ti: cpsw: combine budget and weight split and check Ivan Khoronzhuk
2016-12-10 22:30   ` David Miller
2016-12-10 12:23 ` [PATCH 4/5] net: ethernet: ti: cpsw: re-split res only when speed is changed Ivan Khoronzhuk
2016-12-10 22:30   ` David Miller
2016-12-10 12:23 ` Ivan Khoronzhuk [this message]
2016-12-10 22:30   ` [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode David Miller
2016-12-10 22:30 ` [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy 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=1481372630-14914-6-git-send-email-ivan.khoronzhuk@linaro.org \
    --to=ivan.khoronzhuk@linaro.org \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mugunthanvnm@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).