Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4984125imm; Fri, 18 May 2018 14:16:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq4w/ZPXUYLdv9lqXkkKMIXoj/EJqdBP+ZZnQzvWMk6HvAhDZrwTNTyECuO2Op8dVhmz2l0 X-Received: by 2002:a63:7a5e:: with SMTP id j30-v6mr8842591pgn.145.1526678162668; Fri, 18 May 2018 14:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526678162; cv=none; d=google.com; s=arc-20160816; b=eD27yapLvpwF5wVm8TA/LnVwN08XqvgRsxC53PElTyBPCFjAlpEhNGDHBTeE37tPSj Xwo6gcL4CD6DYSnctQhw3wLcjShfYxrdYL/rxbDAEwdplQVDRSn4bBonZRA8GguwhBRg 9UYF6gCswgSv6vHiN2N8s2hBlwz7NQ/+HRvF4AWOi4Z5HX0we1iMT5n/+foaOvVuAp1Y bV+FJq2QJkJW7uf+t7JUWY5RJhgttz0SWSpK1CT90ZT+WiDsPFDYMD6bPyUyj1dFQmVa 3+N8AjqLbhC6azv+tm3inTeCK8fp5ER5kIJDv68LXAlVUZN61TAeYls9qiaQSnyYHgHB FuMw== 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=evqVlSgwE0Mq3D3CWJiiP/nrSl0JupLCAxkyhHdkCDo=; b=QwAC/70xOaHuRtdygtU3JhZAQrv90RIkitwSgqplMsZfw6qDdufBck6IOhZ2yyHJ0b kot+JraJfk+C6j5HGUekapyVzDYc4Vzt5GlnyNV57Q38ywNOgt9dEaEOklJMWb/WBG2I cxeHluSx0+hVrgdx3817PUNkYGXMo2gx72dvDdUEndwaWOwn1CTN0HgvHI02PzM/5CTE PqIn39KPcG787yyXGUPBirohceXFRX54IySIY1x+TOtgZNsxQ2diatwsgSj9sSmAej6Q /pZF8GUVrUlKqGJ6t0hT49XV4vk9jRp1ZA4oXu9hbgYJFK2bK9hrEZhvlDoHzuPuC1c5 +/LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WoT3uFz2; 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 z9-v6si8218222plo.263.2018.05.18.14.15.48; Fri, 18 May 2018 14:16:02 -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=WoT3uFz2; 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 S1752334AbeERVPZ (ORCPT + 99 others); Fri, 18 May 2018 17:15:25 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34618 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752103AbeERVPU (ORCPT ); Fri, 18 May 2018 17:15:20 -0400 Received: by mail-lf0-f68.google.com with SMTP id x145-v6so3879089lff.1 for ; Fri, 18 May 2018 14:15:19 -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=evqVlSgwE0Mq3D3CWJiiP/nrSl0JupLCAxkyhHdkCDo=; b=WoT3uFz2l1Ig2Hb8nuOBRLmj+prhEM/N7QtBaCTrE5h7DdyLImWJ8EN8BXQgLgBb6z IT9DeRR169jNdTgTTXJXK5rPyxtBId3D3aFbxk4pojtlBMphio0VEX6mcsHNIFZkeNvc Lja90ER3Tx+Eez7UWmVAIjFJcO6I+qfm9+bBw= 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=evqVlSgwE0Mq3D3CWJiiP/nrSl0JupLCAxkyhHdkCDo=; b=jsPjbLQatoN3vcOioId9+PhsRHsaTMWCJkd2CCYprFpTmu4MvQZ5UtWHJfZ3D74TvR gm+wxi5dQdt2zIn6lxla/h8XAbxmaOrb1k0Dk8O2Wx6sBQCKSCny/iX3jPJHU9SijWsP R6P/Gm2OSElI3bHz54dopmInOapayvbnrQJnZYSfSE6JvxJwYYwqBPafW9wmoJhggR2t Dn4gS9QhrWYKEO6hMHq9CkvNhACkUJ1qz6zMCFMAvXp0HVwwTyfi26SNSxdl6QdNg0vM 2+A+AswM5g9V9rdJCErJOs6rjMyYni7LCiulJo5gQq0yPSIlJiqDMW/wrXweKya4dpqR t0xA== X-Gm-Message-State: ALKqPwcl70VQBPAcBRpaQyemPM+yP1cduOeMKYo9JQxHY2f/kT5ocRvp uMJTAz0rDWZZW5544zEcbph4bA== X-Received: by 2002:a2e:2a45:: with SMTP id q66-v6mr6617173ljq.40.1526678118623; Fri, 18 May 2018 14:15:18 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id g20-v6sm2045991lfk.39.2018.05.18.14.15.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 14:15:18 -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, Ivan Khoronzhuk Subject: [RFC PATCH 2/6] net: ethernet: ti: cpdma: fit rated channels in backward order Date: Sat, 19 May 2018 00:15:06 +0300 Message-Id: <20180518211510.13341-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518211510.13341-1-ivan.khoronzhuk@linaro.org> References: <20180518211510.13341-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 31ae04117f0a..37fbdc668cc7 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.0