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


Groups > linux.kernel > #1553932 > unrolled thread

[PATCH] net: ethernet: ti: cpsw: extend limits for cpsw_get/set_ringparam

Started byIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
First post2017-01-08 21:20 +0100
Last post2017-01-09 20:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: ethernet: ti: cpsw: extend limits for cpsw_get/set_ringparam Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2017-01-08 21:20 +0100
    Re: [PATCH] net: ethernet: ti: cpsw: extend limits for  cpsw_get/set_ringparam David Miller <davem@davemloft.net> - 2017-01-09 20:30 +0100

#1553932 — [PATCH] net: ethernet: ti: cpsw: extend limits for cpsw_get/set_ringparam

FromIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date2017-01-08 21:20 +0100
Subject[PATCH] net: ethernet: ti: cpsw: extend limits for cpsw_get/set_ringparam
Message-ID<sXs6B-2Mo-1@gated-at.bofh.it>
Allow to set number of descs close to possible values. In case of
minimum limit it's equal to number of channels to be able to set
at least one desc per channel. For maximum limit leave enough descs
number for tx channels.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---

Based on net-next/master

 drivers/net/ethernet/ti/cpsw.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 458298d..09e0ed6 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2474,8 +2474,7 @@ static void cpsw_get_ringparam(struct net_device *ndev,
 	/* not supported */
 	ering->tx_max_pending = 0;
 	ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma);
-	/* Max 90% RX buffers */
-	ering->rx_max_pending = (descs_pool_size * 9) / 10;
+	ering->rx_max_pending = descs_pool_size - CPSW_MAX_QUEUES;
 	ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma);
 }
 
@@ -2490,8 +2489,8 @@ static int cpsw_set_ringparam(struct net_device *ndev,
 	/* ignore ering->tx_pending - only rx_pending adjustment is supported */
 
 	if (ering->rx_mini_pending || ering->rx_jumbo_pending ||
-	    ering->rx_pending < (descs_pool_size / 10) ||
-	    ering->rx_pending > ((descs_pool_size * 9) / 10))
+	    ering->rx_pending < CPSW_MAX_QUEUES ||
+	    ering->rx_pending > (descs_pool_size - CPSW_MAX_QUEUES))
 		return -EINVAL;
 
 	if (ering->rx_pending == cpdma_get_num_rx_descs(cpsw->dma))
-- 
2.7.4

[toc] | [next] | [standalone]


#1554630 — Re: [PATCH] net: ethernet: ti: cpsw: extend limits for cpsw_get/set_ringparam

FromDavid Miller <davem@davemloft.net>
Date2017-01-09 20:30 +0100
SubjectRe: [PATCH] net: ethernet: ti: cpsw: extend limits for cpsw_get/set_ringparam
Message-ID<sXNNL-8cK-17@gated-at.bofh.it>
In reply to#1553932
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Sun,  8 Jan 2017 22:12:27 +0200

> Allow to set number of descs close to possible values. In case of
> minimum limit it's equal to number of channels to be able to set
> at least one desc per channel. For maximum limit leave enough descs
> number for tx channels.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Applied, thank you.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web