From patchwork Sun Jan 8 20:12:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 9503599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3880C606E1 for ; Sun, 8 Jan 2017 20:12:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FBAC28409 for ; Sun, 8 Jan 2017 20:12:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1339C28416; Sun, 8 Jan 2017 20:12:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97D5328409 for ; Sun, 8 Jan 2017 20:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754582AbdAHUMg (ORCPT ); Sun, 8 Jan 2017 15:12:36 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:33722 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751533AbdAHUMd (ORCPT ); Sun, 8 Jan 2017 15:12:33 -0500 Received: by mail-lf0-f43.google.com with SMTP id k86so83520052lfi.0 for ; Sun, 08 Jan 2017 12:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Ldvt4BPBRSKL3SSJR695t2abUWJpuxgJsFYi13OwKCw=; b=LQH1mPffxOMISIr4qy2gf/BS8cmvENdGUX5UxmwUlqx+hY0YTX/UReAIiRQqMkBBNM SQUzrAHftTiaIE1F89dEwWdg33V7HXSzVPH7NFS+PldcHL85ut0C/3rAI/rPorHT0VbV ocHHYZTzm03clrXcX8ZYM68u0yFIzj4CNwGLo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ldvt4BPBRSKL3SSJR695t2abUWJpuxgJsFYi13OwKCw=; b=tC6q1ChiCoHvRAevuhweA96vqygQz0P2gujeUz6niR/GAiJMlLhX1O6BC+wVnUATU8 JPqF31i7DHJ14dUjfqxz0RYejW0ICLPlev5nIAY5XTJcRWFygE+VY/tOHh9wcO3JkKvi 70ulELEZiLl+01W4x9kg/w+FAmWcUHYwFWLDx1CO6I2wtPvoC7t74z0al2JMuqL3bIf0 er5lwK+7oVl7CCBX9CxGhWqDz9YKQUDoTHYsDfFIenMFuI22TDbWscOg1GvhVc/Lay5i XEyl5EyBlImyMTXkwV6ywk0RdVi6F1hcrPB8vXHeldLzUknyFQ5Ee9tX5EEKJn1YFnB4 +g7A== X-Gm-Message-State: AIkVDXJ7le0WgNwFpgmrvo65WYa/Qv9/1S8ckkALxDNsNVTZHtbyKua/UmzixtiwywnO7QxJ X-Received: by 10.46.6.25 with SMTP id 25mr1060700ljg.64.1483906351034; Sun, 08 Jan 2017 12:12:31 -0800 (PST) Received: from localhost.localdomain (183-224-132-95.pool.ukrtel.net. [95.132.224.183]) by smtp.gmail.com with ESMTPSA id l129sm20713926lfg.47.2017.01.08.12.12.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 12:12:30 -0800 (PST) From: Ivan Khoronzhuk To: netdev@vger.kernel.org, mugunthanvnm@ti.com Cc: linux-omap@vger.kernel.org, grygorii.strashko@ti.com, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH] net: ethernet: ti: cpsw: extend limits for cpsw_get/set_ringparam Date: Sun, 8 Jan 2017 22:12:27 +0200 Message-Id: <1483906347-7567-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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))