diff mbox series

[v2] net: ethernet: ti: cpsw_ethtool: fix ethtool ring param set

Message ID 20190531134725.2054-1-ivan.khoronzhuk@linaro.org (mailing list archive)
State New, archived
Headers show
Series [v2] net: ethernet: ti: cpsw_ethtool: fix ethtool ring param set | expand

Commit Message

Ivan Khoronzhuk May 31, 2019, 1:47 p.m. UTC
Fix ability to set RX descriptor number, the reason - initially
"tx_max_pending" was set incorrectly, but the issue appears after
adding sanity check, so fix is for "sanity" patch.

Fixes: 37e2d99b59c476 ("ethtool: Ensure new ring parameters are within bounds during SRINGPARAM")
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
Based on net/master

 drivers/net/ethernet/ti/cpsw_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Grygorii Strashko June 1, 2019, 10:36 a.m. UTC | #1
On 31/05/2019 16:47, Ivan Khoronzhuk wrote:
> Fix ability to set RX descriptor number, the reason - initially
> "tx_max_pending" was set incorrectly, but the issue appears after
> adding sanity check, so fix is for "sanity" patch.
> 
> Fixes: 37e2d99b59c476 ("ethtool: Ensure new ring parameters are within bounds during SRINGPARAM")
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> ---
> Based on net/master
> 
>   drivers/net/ethernet/ti/cpsw_ethtool.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c
> index a4a7ec0d2531..6d1c9ebae7cc 100644
> --- a/drivers/net/ethernet/ti/cpsw_ethtool.c
> +++ b/drivers/net/ethernet/ti/cpsw_ethtool.c
> @@ -643,7 +643,7 @@ void cpsw_get_ringparam(struct net_device *ndev,
>   	struct cpsw_common *cpsw = priv->cpsw;
>   
>   	/* not supported */
> -	ering->tx_max_pending = 0;
> +	ering->tx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
>   	ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma);
>   	ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
>   	ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma);
> 

Thank you.
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
David Miller June 3, 2019, 9:34 p.m. UTC | #2
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Fri, 31 May 2019 16:47:25 +0300

> Fix ability to set RX descriptor number, the reason - initially
> "tx_max_pending" was set incorrectly, but the issue appears after
> adding sanity check, so fix is for "sanity" patch.
> 
> Fixes: 37e2d99b59c476 ("ethtool: Ensure new ring parameters are within bounds during SRINGPARAM")
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Applied and queued up for -stable, thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c
index a4a7ec0d2531..6d1c9ebae7cc 100644
--- a/drivers/net/ethernet/ti/cpsw_ethtool.c
+++ b/drivers/net/ethernet/ti/cpsw_ethtool.c
@@ -643,7 +643,7 @@  void cpsw_get_ringparam(struct net_device *ndev,
 	struct cpsw_common *cpsw = priv->cpsw;
 
 	/* not supported */
-	ering->tx_max_pending = 0;
+	ering->tx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
 	ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma);
 	ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
 	ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma);