From patchwork Thu Jun 14 07:36:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 138530 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1772858lji; Thu, 14 Jun 2018 00:40:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ0Lu3eXnTm09wh6OQuow4EGDkV1InFwfr25G3YBdRvB1mUcvi+YgPyA3Ryg3T+M/UZdufL X-Received: by 2002:a65:510c:: with SMTP id f12-v6mr1300566pgq.288.1528962018698; Thu, 14 Jun 2018 00:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528962018; cv=none; d=google.com; s=arc-20160816; b=xgxVDTWxzHx13Iyt84CecstIXSDTgaf9z0MCKVR17HRQtiO9N1SqNIMwQ2Ed9LUxhl Ppowv7gipigSkoOMTZ0Zdh3Pzn5Yks9EimcHHLPIcqnYgmeGt8/xd2ZAwFDiJDklIpff lakh+VehV7WjvMKnuGTxiHVnP3I6f6G+BQe3gFQck5O/qLTkUBh4puLZO6QSbFJnAJWx A5dxWRNsPkS2DvFMxmwclb0/oGXoqH3t8VOzdkq2tM7bC7x8uMZjyxn42wGmRp7gSsKB Fvw1YIh1KjO2GGButCiCvghK7C3vG99C5E80gR+SfrQvAhaEfx08+AlzzCCxBLo6j4I4 /IpQ== 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 o12-v6si4716443pfd.52.2018.06.14.00.40.18; Thu, 14 Jun 2018 00:40:18 -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 S1754942AbeFNHkQ (ORCPT + 30 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(-) -- 2.17.1 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,