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: 90321 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp567265qgi; Sun, 8 Jan 2017 12:12:40 -0800 (PST) X-Received: by 10.99.149.1 with SMTP id p1mr159118827pgd.21.1483906360693; Sun, 08 Jan 2017 12:12:40 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32si7308018plf.34.2017.01.08.12.12.39; Sun, 08 Jan 2017 12:12:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754582AbdAHUMg (ORCPT + 4 others); 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 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(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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))