Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1618493imm; Thu, 14 Jun 2018 00:42:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIq4VdXcuDQDswop6UQcE4TMERH3CqJ/4PvE1XnREdWTDW5e8mq6+O+Ix5osIN1bSJ3smml X-Received: by 2002:a65:57c6:: with SMTP id q6-v6mr1350604pgr.160.1528962148829; Thu, 14 Jun 2018 00:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528962148; cv=none; d=google.com; s=arc-20160816; b=F5DiWv+jFYe7WUgGFVpRFO2djSyKnBAGO+DDZunbtO7bxRsVvro/JLKIzcB/Lr9ty5 a3krCbiqLHPiQzTAIYVMJU4lHa+XMtxFHsoZRgzF8MTRdYMKm7JT9duIuJfZ3mugShAd aHtnsYHvHlZ4Z4GnBMFnU/zFWXD2Wc9XHypUmOTEaf2ZpfawFfYGnxPjLQMSMGCBU7xQ 3IHhH6z2WpAGMxCDCgi2JVfiDc6BwgMe/9bfBN2AGH8NQpZfSHXdx2citQG07Cw+qRZg O1uf4mKszYXQRkzP4ce3/xTFm23PauS6N72uBlEYtOGE1CSZnYzkpybRNTSiRg2cwcwi 4aXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=lDdZ+12ye4H9JsUdu5+2AMHnLkdkF7ofjKyzEJiIn2U=; b=UVE+tZDS+qeYplxUydBzj0YsfPxC+O6ZwXlAZMBpSs3dZq7JRrKzaCfS+W0OfRmjr3 4Va70zs2CB8qDRMLUSKEM2aQ5iwAeEEzcdpQTZEMSLEu7IRKds2Q+4il6BARk6HJIuY7 MvVFLORGKqtipPIHVx8DVgwXDxj081vlc11cxC/n44tNzxEQmJ0HkIbJvffuC9i0yslC hn07vsdd+fedizV8blmzLvJ0m2d/4a/cOyYuB8YE6hun+zfzL1y8hw8P3BsTfOQ8AVYD //9Zz8MqTQu+a9Xik9k6WbseWBMVACB87aXEhY0urhnrcEe/WovrJ3ASfMfLI5lVRWCB whcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=STRoQbpG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20-v6si3908011pgn.464.2018.06.14.00.42.14; Thu, 14 Jun 2018 00:42:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=STRoQbpG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754935AbeFNHkQ (ORCPT + 99 others); Thu, 14 Jun 2018 03:40:16 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:39805 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754651AbeFNHhN (ORCPT ); Thu, 14 Jun 2018 03:37:13 -0400 Received: by mail-lf0-f65.google.com with SMTP id t2-v6so1444663lfd.6 for ; Thu, 14 Jun 2018 00:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lDdZ+12ye4H9JsUdu5+2AMHnLkdkF7ofjKyzEJiIn2U=; b=STRoQbpGiVgjPT1GFPT8LaMG0ruDuuCw0VBV4Coh39xI3GKkKIsAeS/kUUpGT/HuVA qiTuldAkOf0PFPN52qaTFUmTjAEWZGr/Ri2Jias/VMMQLUuyKihkHzRpfZb+PsAzekkU FaGuJ82/9+e6qwBqRzqtFyxkr06+VpFlnNudU= 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:in-reply-to :references; bh=lDdZ+12ye4H9JsUdu5+2AMHnLkdkF7ofjKyzEJiIn2U=; b=iBpT1e8+ap64L+pe1ZS1GkfyWa73s6rJIFa+Kks8JfL9AYIpbYW72N4TPRfoZjiqXr 6FU495fBCkeVYg2ayFHkJ/WWw+sITxPPxV1vBR4B8epZWx0zeROMowapOAkGXA4l64tx tUTsf8bJ9aakc5vwhkINcJvwzrg72bTX6fr1KNxojIVs9L5iO1vlLVrvhEvTEnnGxyUS 0dTewMmGvmLAOmEB/dvjrcl0TWC3lYXntnoOIi++YCH5Hlp/XOyRi57Kxq9qvg9jJZ4I N32xIviKzmHM1eqypkykYd8TuABiVyr/QKsL91i9vndbsyf9JqbM/SCxkfsGG1NEWPZG HEvw== X-Gm-Message-State: APt69E3jhxCCHtjBymSG3xZ002lr+TMsCxHycC12V9tBb90rEG2+8gYt NLKSo7QVNYyYl7iucGIXnhCQIA== X-Received: by 2002:a2e:4942:: with SMTP id b2-v6mr948351ljd.138.1528961831590; Thu, 14 Jun 2018 00:37:11 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id a195-v6sm957597lfe.44.2018.06.14.00.37.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 00:37:10 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, davem@davemloft.net Cc: corbet@lwn.net, akpm@linux-foundation.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, vinicius.gomes@intel.com, henrik@austad.us, jesus.sanchez-palencia@intel.com, ilias.apalodimas@linaro.org, p-varis@ti.com, spatton@ti.com, francois.ozog@linaro.org, yogeshs@ti.com, nsekhar@ti.com, andrew@lunn.ch, Ivan Khoronzhuk Subject: [PATCH v2 net-next 2/6] net: ethernet: ti: cpdma: fit rated channels in backward order Date: Thu, 14 Jun 2018 10:36:46 +0300 Message-Id: <20180614073650.29659-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614073650.29659-1-ivan.khoronzhuk@linaro.org> References: <20180614073650.29659-1-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to TRM tx rated channels should be in 7..0 order, so correct it. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/davinci_cpdma.c | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index cdbddf16dd29..19bb63902997 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c @@ -406,37 +406,36 @@ static int cpdma_chan_fit_rate(struct cpdma_chan *ch, u32 rate, struct cpdma_chan *chan; u32 old_rate = ch->rate; u32 new_rmask = 0; - int rlim = 1; + int rlim = 0; int i; - *prio_mode = 0; for (i = tx_chan_num(0); i < tx_chan_num(CPDMA_MAX_CHANNELS); i++) { chan = ctlr->channels[i]; - if (!chan) { - rlim = 0; + if (!chan) continue; - } if (chan == ch) chan->rate = rate; if (chan->rate) { - if (rlim) { - new_rmask |= chan->mask; - } else { - ch->rate = old_rate; - dev_err(ctlr->dev, "Prev channel of %dch is not rate limited\n", - chan->chan_num); - return -EINVAL; - } - } else { - *prio_mode = 1; - rlim = 0; + rlim = 1; + new_rmask |= chan->mask; + continue; } + + if (rlim) + goto err; } *rmask = new_rmask; + *prio_mode = rlim; return 0; + +err: + ch->rate = old_rate; + dev_err(ctlr->dev, "Upper cpdma ch%d is not rate limited\n", + chan->chan_num); + return -EINVAL; } static u32 cpdma_chan_set_factors(struct cpdma_ctlr *ctlr, -- 2.17.1