netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy
@ 2016-12-10 12:23 Ivan Khoronzhuk
  2016-12-10 12:23 ` [PATCH 1/5] net: ethernet: ti: cpsw: use same macros to get active slave Ivan Khoronzhuk
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Ivan Khoronzhuk @ 2016-12-10 12:23 UTC (permalink / raw)
  To: mugunthanvnm, grygorii.strashko
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

This patches add several simplifications and improvements to set
maximum rate for channels taking in account switch and dual emac mode.

Don't re-split res in the following cases:
- speed of phys is not changed
- speed of phys is changed and no rate limited channels
- speed of phys is changed and all channels are rate limited
- phy is unlinked while dev is open
- phy is linked back but speed is not changed

The maximum speed is sum of "linked" phys, thus res are split taken
into account two interfaces, both for dual emac mode and for
switch mode.

Tested on am572x

Based on net-next/master

Ivan Khoronzhuk (5):
  net: ethernet: ti: cpsw: use same macros to get active slave
  net: ethernet: ti: cpsw: don't start queue twice
  net: ethernet: ti: cpsw: combine budget and weight split and check
  net: ethernet: ti: cpsw: re-split res only when speed is changed
  net: ethernet: ti: cpsw: sync rates for channels in dual emac mode

 drivers/net/ethernet/ti/cpsw.c | 178 +++++++++++++++++++++++------------------
 1 file changed, 99 insertions(+), 79 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] net: ethernet: ti: cpsw: use same macros to get active slave
  2016-12-10 12:23 [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy Ivan Khoronzhuk
@ 2016-12-10 12:23 ` Ivan Khoronzhuk
  2016-12-10 12:23 ` [PATCH 2/5] net: ethernet: ti: cpsw: don't start queue twice Ivan Khoronzhuk
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Ivan Khoronzhuk @ 2016-12-10 12:23 UTC (permalink / raw)
  To: mugunthanvnm, grygorii.strashko
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

Use the same, more convenient macros, to get active slave.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 drivers/net/ethernet/ti/cpsw.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index b62d958..c45f7d2 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1624,10 +1624,7 @@ static void cpsw_hwtstamp_v2(struct cpsw_priv *priv)
 	struct cpsw_common *cpsw = priv->cpsw;
 	u32 ctrl, mtype;
 
-	if (cpsw->data.dual_emac)
-		slave = &cpsw->slaves[priv->emac_port];
-	else
-		slave = &cpsw->slaves[cpsw->data.active_slave];
+	slave = &cpsw->slaves[cpsw_slave_index(cpsw, priv)];
 
 	ctrl = slave_read(slave, CPSW2_CONTROL);
 	switch (cpsw->version) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] net: ethernet: ti: cpsw: don't start queue twice
  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 ` 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
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Ivan Khoronzhuk @ 2016-12-10 12:23 UTC (permalink / raw)
  To: mugunthanvnm, grygorii.strashko
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

No need to start queues after cpsw is started as it will be done
while cpsw_adjust_link(), after phy connection.

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

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index c45f7d2..23213a3 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1506,8 +1506,6 @@ static int cpsw_ndo_open(struct net_device *ndev)
 	if (cpsw->data.dual_emac)
 		cpsw->slaves[priv->emac_port].open_stat = true;
 
-	netif_tx_start_all_queues(ndev);
-
 	return 0;
 
 err_cleanup:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] net: ethernet: ti: cpsw: combine budget and weight split and check
  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 12:23 ` 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
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Ivan Khoronzhuk @ 2016-12-10 12:23 UTC (permalink / raw)
  To: mugunthanvnm, grygorii.strashko
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

Re-split weight along with budget. It simplify code a little
and update state after every rate change. Also it's necessarily
to move arguments checks to this combined function. Replace
maximum rate check for an interface on maximum possible rate.

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

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 23213a3..a2c2c06 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -753,27 +753,18 @@ static void cpsw_rx_handler(void *token, int len, int status)
 		dev_kfree_skb_any(new_skb);
 }
 
-/* split budget depending on channel rates */
-static void cpsw_split_budget(struct net_device *ndev)
+static void cpsw_split_res(struct net_device *ndev)
 {
 	struct cpsw_priv *priv = netdev_priv(ndev);
+	u32 consumed_rate = 0, bigest_rate = 0;
 	struct cpsw_common *cpsw = priv->cpsw;
 	struct cpsw_vector *txv = cpsw->txv;
-	u32 consumed_rate, bigest_rate = 0;
+	int i, ch_weight, rlim_ch_num = 0;
 	int budget, bigest_rate_ch = 0;
 	struct cpsw_slave *slave;
-	int i, rlim_ch_num = 0;
 	u32 ch_rate, max_rate;
 	int ch_budget = 0;
 
-	if (cpsw->data.dual_emac)
-		slave = &cpsw->slaves[priv->emac_port];
-	else
-		slave = &cpsw->slaves[cpsw->data.active_slave];
-
-	max_rate = slave->phy->speed * 1000;
-
-	consumed_rate = 0;
 	for (i = 0; i < cpsw->tx_ch_num; i++) {
 		ch_rate = cpdma_chan_get_rate(txv[i].ch);
 		if (!ch_rate)
@@ -785,7 +776,14 @@ static void cpsw_split_budget(struct net_device *ndev)
 
 	if (cpsw->tx_ch_num == rlim_ch_num) {
 		max_rate = consumed_rate;
+	} else if (!rlim_ch_num) {
+		ch_budget = CPSW_POLL_WEIGHT / cpsw->tx_ch_num;
+		bigest_rate = 0;
+		max_rate = consumed_rate;
 	} else {
+		slave = &cpsw->slaves[cpsw_slave_index(cpsw, priv)];
+		max_rate = slave->phy->speed * 1000;
+
 		ch_budget = (consumed_rate * CPSW_POLL_WEIGHT) / max_rate;
 		ch_budget = (CPSW_POLL_WEIGHT - ch_budget) /
 			    (cpsw->tx_ch_num - rlim_ch_num);
@@ -793,22 +791,28 @@ static void cpsw_split_budget(struct net_device *ndev)
 			      (cpsw->tx_ch_num - rlim_ch_num);
 	}
 
-	/* split tx budget */
+	/* split tx weight/budget */
 	budget = CPSW_POLL_WEIGHT;
 	for (i = 0; i < cpsw->tx_ch_num; i++) {
 		ch_rate = cpdma_chan_get_rate(txv[i].ch);
 		if (ch_rate) {
 			txv[i].budget = (ch_rate * CPSW_POLL_WEIGHT) / max_rate;
 			if (!txv[i].budget)
-				txv[i].budget = 1;
+				txv[i].budget++;
 			if (ch_rate > bigest_rate) {
 				bigest_rate_ch = i;
 				bigest_rate = ch_rate;
 			}
+
+			ch_weight = (ch_rate * 100) / max_rate;
+			if (!ch_weight)
+				ch_weight++;
+			cpdma_chan_set_weight(cpsw->txv[i].ch, ch_weight);
 		} else {
 			txv[i].budget = ch_budget;
 			if (!bigest_rate_ch)
 				bigest_rate_ch = i;
+			cpdma_chan_set_weight(cpsw->txv[i].ch, 0);
 		}
 
 		budget -= txv[i].budget;
@@ -1017,7 +1021,7 @@ static void cpsw_adjust_link(struct net_device *ndev)
 	for_each_slave(priv, _cpsw_adjust_link, priv, &link);
 
 	if (link) {
-		cpsw_split_budget(priv->ndev);
+		cpsw_split_res(priv->ndev);
 		netif_carrier_on(ndev);
 		if (netif_running(ndev))
 			netif_tx_wake_all_queues(ndev);
@@ -1962,64 +1966,25 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
 static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
 {
 	struct cpsw_priv *priv = netdev_priv(ndev);
-	int tx_ch_num = ndev->real_num_tx_queues;
-	u32 consumed_rate, min_rate, max_rate;
 	struct cpsw_common *cpsw = priv->cpsw;
-	struct cpsw_slave *slave;
-	int ret, i, weight;
-	int rlim_num = 0;
+	u32 min_rate;
 	u32 ch_rate;
+	int ret;
 
 	ch_rate = netdev_get_tx_queue(ndev, queue)->tx_maxrate;
 	if (ch_rate == rate)
 		return 0;
 
-	if (cpsw->data.dual_emac)
-		slave = &cpsw->slaves[priv->emac_port];
-	else
-		slave = &cpsw->slaves[cpsw->data.active_slave];
-	max_rate = slave->phy->speed;
-
-	consumed_rate = 0;
-	for (i = 0; i < tx_ch_num; i++) {
-		if (i == queue)
-			ch_rate = rate;
-		else
-			ch_rate = netdev_get_tx_queue(ndev, i)->tx_maxrate;
-		if (!ch_rate)
-			continue;
-
-		rlim_num++;
-		consumed_rate += ch_rate;
-	}
-
-	if (consumed_rate > max_rate)
-		dev_info(priv->dev, "The common rate shouldn't be more than %dMbps",
-			 max_rate);
-
-	if (consumed_rate > max_rate) {
-		if (max_rate == 10 && consumed_rate <= 100) {
-			max_rate = 100;
-		} else if (max_rate <= 100 && consumed_rate <= 1000) {
-			max_rate = 1000;
-		} else {
-			dev_err(priv->dev, "The common rate cannot be more than %dMbps",
-				max_rate);
-			return -EINVAL;
-		}
-	}
-
-	if (consumed_rate > max_rate) {
-		dev_err(priv->dev, "The common rate cannot be more than %dMbps",
-			max_rate);
+	ch_rate = rate * 1000;
+	min_rate = cpdma_chan_get_min_rate(cpsw->dma);
+	if ((ch_rate < min_rate && ch_rate)) {
+		dev_err(priv->dev, "The channel rate cannot be less than %dMbps",
+			min_rate);
 		return -EINVAL;
 	}
 
-	rate *= 1000;
-	min_rate = cpdma_chan_get_min_rate(cpsw->dma);
-	if ((rate < min_rate && rate)) {
-		dev_err(priv->dev, "The common rate cannot be less than %dMbps",
-			min_rate);
+	if (rate > 2000) {
+		dev_err(priv->dev, "The channel rate cannot be more than 2Gbps");
 		return -EINVAL;
 	}
 
@@ -2029,17 +1994,13 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
 		return ret;
 	}
 
-	if (rlim_num == tx_ch_num)
-		max_rate = consumed_rate;
+	ret = cpdma_chan_set_rate(cpsw->txv[queue].ch, ch_rate);
+	pm_runtime_put(cpsw->dev);
 
-	weight = (rate * 100) / (max_rate * 1000);
-	cpdma_chan_set_weight(cpsw->txv[queue].ch, weight);
-	ret = cpdma_chan_set_rate(cpsw->txv[queue].ch, rate);
+	if (ret)
+		return ret;
 
-	/* re-split budget between channels */
-	if (!rate)
-		cpsw_split_budget(ndev);
-	pm_runtime_put(cpsw->dev);
+	cpsw_split_res(ndev);
 	return ret;
 }
 
@@ -2399,7 +2360,7 @@ static int cpsw_set_channels(struct net_device *ndev,
 		if (ret)
 			goto err;
 
-		cpsw_split_budget(ndev);
+		cpsw_split_res(ndev);
 
 		/* After this receive is started */
 		cpdma_ctlr_start(cpsw->dma);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] net: ethernet: ti: cpsw: re-split res only when speed is changed
  2016-12-10 12:23 [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy Ivan Khoronzhuk
                   ` (2 preceding siblings ...)
  2016-12-10 12:23 ` [PATCH 3/5] net: ethernet: ti: cpsw: combine budget and weight split and check Ivan Khoronzhuk
@ 2016-12-10 12:23 ` Ivan Khoronzhuk
  2016-12-10 22:30   ` David Miller
  2016-12-10 12:23 ` [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode Ivan Khoronzhuk
  2016-12-10 22:30 ` [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy David Miller
  5 siblings, 1 reply; 11+ messages in thread
From: Ivan Khoronzhuk @ 2016-12-10 12:23 UTC (permalink / raw)
  To: mugunthanvnm, grygorii.strashko
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

Don't re-split res in the following cases:
- speed of phys is not changed
- speed of phys is changed and no rate limited channels
- speed of phys is changed and all channels are rate limited
- phy is unlinked while dev is open
- phy is linked back but speed is not changed

The maximum speed is sum of "linked" phys, thus res are split taken
in account two interfaces, both for dual emac mode and for
switch mode.

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

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index a2c2c06..7ccfa63 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -394,6 +394,7 @@ struct cpsw_common {
 	u32 irqs_table[IRQ_NUM];
 	struct cpts			*cpts;
 	int				rx_ch_num, tx_ch_num;
+	int				speed;
 };
 
 struct cpsw_priv {
@@ -761,7 +762,6 @@ static void cpsw_split_res(struct net_device *ndev)
 	struct cpsw_vector *txv = cpsw->txv;
 	int i, ch_weight, rlim_ch_num = 0;
 	int budget, bigest_rate_ch = 0;
-	struct cpsw_slave *slave;
 	u32 ch_rate, max_rate;
 	int ch_budget = 0;
 
@@ -781,8 +781,16 @@ static void cpsw_split_res(struct net_device *ndev)
 		bigest_rate = 0;
 		max_rate = consumed_rate;
 	} else {
-		slave = &cpsw->slaves[cpsw_slave_index(cpsw, priv)];
-		max_rate = slave->phy->speed * 1000;
+		max_rate = cpsw->speed * 1000;
+
+		/* if max_rate is less then expected due to reduced link speed,
+		 * split proportionally according next potential max speed
+		 */
+		if (max_rate < consumed_rate)
+			max_rate *= 10;
+
+		if (max_rate < consumed_rate)
+			max_rate *= 10;
 
 		ch_budget = (consumed_rate * CPSW_POLL_WEIGHT) / max_rate;
 		ch_budget = (CPSW_POLL_WEIGHT - ch_budget) /
@@ -1013,15 +1021,56 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave,
 	slave->mac_control = mac_control;
 }
 
+static int cpsw_get_common_speed(struct cpsw_common *cpsw)
+{
+	int i, speed;
+
+	for (i = 0, speed = 0; i < cpsw->data.slaves; i++)
+		if (cpsw->slaves[i].phy && cpsw->slaves[i].phy->link)
+			speed += cpsw->slaves[i].phy->speed;
+
+	return speed;
+}
+
+static int cpsw_need_resplit(struct cpsw_common *cpsw)
+{
+	int i, rlim_ch_num;
+	int speed, ch_rate;
+
+	/* re-split resources only in case speed was changed */
+	speed = cpsw_get_common_speed(cpsw);
+	if (speed == cpsw->speed || !speed)
+		return 0;
+
+	cpsw->speed = speed;
+
+	for (i = 0, rlim_ch_num = 0; i < cpsw->tx_ch_num; i++) {
+		ch_rate = cpdma_chan_get_rate(cpsw->txv[i].ch);
+		if (!ch_rate)
+			break;
+
+		rlim_ch_num++;
+	}
+
+	/* cases not dependent on speed */
+	if (!rlim_ch_num || rlim_ch_num == cpsw->tx_ch_num)
+		return 0;
+
+	return 1;
+}
+
 static void cpsw_adjust_link(struct net_device *ndev)
 {
 	struct cpsw_priv	*priv = netdev_priv(ndev);
+	struct cpsw_common	*cpsw = priv->cpsw;
 	bool			link = false;
 
 	for_each_slave(priv, _cpsw_adjust_link, priv, &link);
 
 	if (link) {
-		cpsw_split_res(priv->ndev);
+		if (cpsw_need_resplit(cpsw))
+			cpsw_split_res(ndev);
+
 		netif_carrier_on(ndev);
 		if (netif_running(ndev))
 			netif_tx_wake_all_queues(ndev);
@@ -1538,6 +1587,10 @@ static int cpsw_ndo_stop(struct net_device *ndev)
 		cpsw_ale_stop(cpsw->ale);
 	}
 	for_each_slave(priv, cpsw_slave_stop, cpsw);
+
+	if (cpsw_need_resplit(cpsw))
+		cpsw_split_res(ndev);
+
 	pm_runtime_put_sync(cpsw->dev);
 	if (cpsw->data.dual_emac)
 		cpsw->slaves[priv->emac_port].open_stat = false;
@@ -1983,7 +2036,7 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
 		return -EINVAL;
 	}
 
-	if (rate > 2000) {
+	if (rate > cpsw->speed) {
 		dev_err(priv->dev, "The channel rate cannot be more than 2Gbps");
 		return -EINVAL;
 	}
@@ -2998,6 +3051,7 @@ static int cpsw_probe(struct platform_device *pdev)
 	ndev->ethtool_ops = &cpsw_ethtool_ops;
 	netif_napi_add(ndev, &cpsw->napi_rx, cpsw_rx_poll, CPSW_POLL_WEIGHT);
 	netif_tx_napi_add(ndev, &cpsw->napi_tx, cpsw_tx_poll, CPSW_POLL_WEIGHT);
+	cpsw_split_res(ndev);
 
 	/* register the network device */
 	SET_NETDEV_DEV(ndev, &pdev->dev);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode
  2016-12-10 12:23 [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy Ivan Khoronzhuk
                   ` (3 preceding siblings ...)
  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 12:23 ` Ivan Khoronzhuk
  2016-12-10 22:30   ` David Miller
  2016-12-10 22:30 ` [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy David Miller
  5 siblings, 1 reply; 11+ messages in thread
From: Ivan Khoronzhuk @ 2016-12-10 12:23 UTC (permalink / raw)
  To: mugunthanvnm, grygorii.strashko
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy
  2016-12-10 12:23 [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy Ivan Khoronzhuk
                   ` (4 preceding siblings ...)
  2016-12-10 12:23 ` [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode Ivan Khoronzhuk
@ 2016-12-10 22:30 ` David Miller
  5 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2016-12-10 22:30 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: mugunthanvnm, grygorii.strashko, linux-omap, netdev, linux-kernel

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Sat, 10 Dec 2016 14:23:45 +0200

> This patches add several simplifications and improvements to set
> maximum rate for channels taking in account switch and dual emac mode.
> 
> Don't re-split res in the following cases:
> - speed of phys is not changed
> - speed of phys is changed and no rate limited channels
> - speed of phys is changed and all channels are rate limited
> - phy is unlinked while dev is open
> - phy is linked back but speed is not changed
> 
> The maximum speed is sum of "linked" phys, thus res are split taken
> into account two interfaces, both for dual emac mode and for
> switch mode.
> 
> Tested on am572x
> 
> Based on net-next/master

Applied.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/5] net: ethernet: ti: cpsw: don't start queue twice
  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
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2016-12-10 22:30 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: mugunthanvnm, grygorii.strashko, linux-omap, netdev, linux-kernel

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Sat, 10 Dec 2016 14:23:47 +0200

> No need to start queues after cpsw is started as it will be done
> while cpsw_adjust_link(), after phy connection.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Applied.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] net: ethernet: ti: cpsw: combine budget and weight split and check
  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
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2016-12-10 22:30 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: mugunthanvnm, grygorii.strashko, linux-omap, netdev, linux-kernel

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Sat, 10 Dec 2016 14:23:48 +0200

> Re-split weight along with budget. It simplify code a little
> and update state after every rate change. Also it's necessarily
> to move arguments checks to this combined function. Replace
> maximum rate check for an interface on maximum possible rate.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Applied.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] net: ethernet: ti: cpsw: re-split res only when speed is changed
  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
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2016-12-10 22:30 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: mugunthanvnm, grygorii.strashko, linux-omap, netdev, linux-kernel

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Sat, 10 Dec 2016 14:23:49 +0200

> Don't re-split res in the following cases:
> - speed of phys is not changed
> - speed of phys is changed and no rate limited channels
> - speed of phys is changed and all channels are rate limited
> - phy is unlinked while dev is open
> - phy is linked back but speed is not changed
> 
> The maximum speed is sum of "linked" phys, thus res are split taken
> in account two interfaces, both for dual emac mode and for
> switch mode.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Applied.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode
  2016-12-10 12:23 ` [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode Ivan Khoronzhuk
@ 2016-12-10 22:30   ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2016-12-10 22:30 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: mugunthanvnm, grygorii.strashko, linux-omap, netdev, linux-kernel

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Sat, 10 Dec 2016 14:23:50 +0200

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

Applied.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-12-10 22:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode Ivan Khoronzhuk
2016-12-10 22:30   ` David Miller
2016-12-10 22:30 ` [PATCH 1/5] net: ethernet: ti: cpsw: improve re-split policy David Miller

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