Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4067693imm; Mon, 11 Jun 2018 06:32:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJa/oRVAU1nD0JcPDA9RHxjmn/l916/YVNI7szkxBV93GYaFw4Yp1inVcsSAcZ66tlTcZaY X-Received: by 2002:a62:ecdb:: with SMTP id e88-v6mr17855724pfm.16.1528723952564; Mon, 11 Jun 2018 06:32:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528723952; cv=none; d=google.com; s=arc-20160816; b=iZNdXXzTDdJIpNK1A1fhdmuHe4G8O5hzez8wjnQs74ztorcQ7kKTj0/BCuDcf245TK hrlZknYc4wlb4ai/kh7e26Clc2M27TCt4dOi5fOtR1Lupu9sZSj9vf/bgq2tSGZ7npq9 ZTChD43af3Q2DGdXlpVfo7zsbiuHppkAry5SmdwVCHfDCIohNKKZOGlLk8ysMNRzDQdg c9o4Smadz2xlnhgkecFMP4lC0y/5wCgyrFaIO6ojtNPJnIT3MPmQMVRCWLPRnX4PBAOQ nL5v3AZ1fKkMWUgrcsx50ngfLaJU/2/e52811yChRyTAqaeQI0U5o7sIYeo82r5h2aAV y5tA== 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=pvfnJvNQhG59OOZqggcHDMPYXj+Yae3XxUkn6rYhWkKKVWsqJZhA7Y78S+vDQhng7h b5tRFtFKDHOAVbJC4JHhnVtr/dfIm2+StDdY0SzgF4h4EI5WGX9cLVtGmnP0mhFLihA1 VUPgCjcbXGMOvQAhIeCDM70Pu907m+mRgG5nACiMaEfYCmKiNAhWsJy1xCjEVxnrZtpv Uf4Ed0REYT9RfDYAgCuqNOxjx5D9F3Y75EdBy5OzPFbTx18Bu6kCfa1i5XFJCVlds/J0 K+4PhnBRSs1UXFLu3wdEuSwo3YT3C6IhJV8K+uN5nbL685zwVMyoM3Pau26BY2JMzpXX 9t5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hu84LKHy; 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 e4-v6si4452293pga.379.2018.06.11.06.32.18; Mon, 11 Jun 2018 06:32:32 -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=hu84LKHy; 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 S933020AbeFKNbG (ORCPT + 99 others); Mon, 11 Jun 2018 09:31:06 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:40253 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754224AbeFKNbA (ORCPT ); Mon, 11 Jun 2018 09:31:00 -0400 Received: by mail-lf0-f65.google.com with SMTP id q11-v6so30558632lfc.7 for ; Mon, 11 Jun 2018 06:31:00 -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=hu84LKHy75/wLhFShXTYOjz0+SniVId4gbnyRZqiEad/oW5UIJ0F4N3k1W1I1Vjhni wem/FGQmtc46tuPLhMCbWoTGhp2EQah59mgKS7o7FF6gPxoA+X4EuBk1WVR1wyfXFMIa hJR8r3MbZySYsolK5ghcneJBgNZWeegwFkkxE= 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=AOm653tE8qixiVr2Zlodk1VF7TOj4u+N/oFqruXhmzYmRzjhIsSNbCLQk3HcE4TPyi XpZSCxKwZ4PSYTmLkTk7gQZ1nj7xdm+8UnEfAgxvbUx1JVXYnft/Mzy6xlB6ABgOsZtk 9dOzQwe9ico02P1VLZTERp2DaJW78WxdOaCbuFVoQDQ9Fwkn0pD+8k0oh9Obgik7h/kB vt+30k7VIpa/n2iumNeMoSsXKdILfYkZ/QbdX8PzZz9Ht6GGaxP6sILjph/h5UIKpMQu QiSfXXnWvFEKmJcbw78HpmXFLIzCQe6Yppb37Of99uQQ/d8sbRIFA60CqVp+ey8Dgolm 6xcQ== X-Gm-Message-State: APt69E0Gz4QhrjGkpWZXMncCeu784tNeIvJ0nJokCHJ9QwxtVqUZADuN 5LkscEyNzOi/udOnBPXOwa9rEQ== X-Received: by 2002:a2e:1188:: with SMTP id 8-v6mr12288206ljr.38.1528723859491; Mon, 11 Jun 2018 06:30:59 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id u24-v6sm2617712ljj.96.2018.06.11.06.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 06:30:58 -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, Ivan Khoronzhuk Subject: [PATCH net-next 2/6] net: ethernet: ti: cpdma: fit rated channels in backward order Date: Mon, 11 Jun 2018 16:30:43 +0300 Message-Id: <20180611133047.4818-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180611133047.4818-1-ivan.khoronzhuk@linaro.org> References: <20180611133047.4818-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