Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539820

[PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode

From Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode
Date 2016-12-10 13:30 +0100
Message-ID <sMOWR-2d6-27@gated-at.bofh.it> (permalink)
References <sMOWR-2d6-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-12-10 13:30 +0100
  [PATCH 1/5] net: ethernet: ti: cpsw: use same macros to get active slave Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-12-10 13:30 +0100
  [PATCH 4/5] net: ethernet: ti: cpsw: re-split res only when speed is changed Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-12-10 13:30 +0100
    Re: [PATCH 4/5] net: ethernet: ti: cpsw: re-split res only when  speed is changed David Miller <davem@davemloft.net> - 2016-12-10 23:40 +0100
  [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-12-10 13:30 +0100
    Re: [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels  in dual emac mode David Miller <davem@davemloft.net> - 2016-12-10 23:40 +0100
  [PATCH 3/5] net: ethernet: ti: cpsw: combine budget and weight split and check Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-12-10 13:30 +0100
    Re: [PATCH 3/5] net: ethernet: ti: cpsw: combine budget and weight  split and check David Miller <davem@davemloft.net> - 2016-12-10 23:40 +0100
  Re: [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy David Miller <davem@davemloft.net> - 2016-12-10 23:40 +0100

csiph-web