Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1105600imm; Fri, 15 Jun 2018 11:16:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKcB4w+4DbYTAbFOxDmJDHHL3MlKjo+NZbEcnEZt8KKcyxDrC2syep/R/gnDqIntmYS3zf9 X-Received: by 2002:a63:ac57:: with SMTP id z23-v6mr2475134pgn.394.1529086587471; Fri, 15 Jun 2018 11:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529086587; cv=none; d=google.com; s=arc-20160816; b=pSCP6NYGVMJ2Wv7AHE9FM6VlnjjqSvsc3PGqMgIEShSTGhExjFbfghvCbTnE7nXEIY LBLKC5lkYY7J1BQ9T+z8CyPPEkpChvgO5yCJ7iF62pOS0ddw9v5bZIg8+YkPIfBm6szP z8ejpHbPf78CIaTeI7/zS8Za5Htj8c1gqVSIAqdZ8OB5QfBSLTaZpmPXldrktVKeLHOL WQnzcyblKkU/iJ3UsS9ZGn1TE8PxL3BVIjsxpizSPAhSSOlvAHGFSzWgamq9gyzOqyI+ RPjwC4aBpmo7R3u3AiCu5eULsaSUCVzQ8RxzaIGUPdWageLepiQu4CYAjyOXmlZ8Q/cJ 5YJw== 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=frBhnpYFtuskMPYHhSVIvuetOSSSrUrfMAiPWVIcMDk7tjgt4xN+fJu16vQHZ4uUoj CNmIwa2cpDflXb/L2A9OBK6JP51Val39k5EC2ZZQxxWJLZhmM7JG7v2DPp8uqWJ9Mr10 TtbxPrdLaHHmK3r9bjc4PKL4HbasUmCGWna+gGU2YwAKhIL3gWkEgbmOGH9ZgrnGZKZj ySOCCX7cfbvYSt9vjHFYu1VJKI+exW+RgXuZq5wMKdp4oVzrBjkUurCBmxwSX8j0+wfS Po0JJ7OnDqpVbK1poHSSqRXiKbptuKXEIhYwak3Lo3XEcwQ0jP6eQ/UxUa4HQf0h9hWi eQ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IfRPxcLI; 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 d1-v6si9468279pln.471.2018.06.15.11.16.13; Fri, 15 Jun 2018 11:16:27 -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=IfRPxcLI; 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 S1756394AbeFOSNW (ORCPT + 99 others); Fri, 15 Jun 2018 14:13:22 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:46970 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756357AbeFOSNT (ORCPT ); Fri, 15 Jun 2018 14:13:19 -0400 Received: by mail-lf0-f65.google.com with SMTP id j13-v6so15867249lfb.13 for ; Fri, 15 Jun 2018 11:13:18 -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=IfRPxcLIjhv5rwWKSEbqR8yid/fsoVD0RlGYDA8BZvMFAvGlGS3ySmbjDHH/b3zATR GOhQRiE7qg996XWPlSZM0O2Jh9frRJTK7+8fhCbT1awNz07XIvykBmgSn4bxMCoZC2Io 836LWsaT4GzWqYFJoU82a4rck2sQEzcyDRSj0= 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=RrErCqS9CjhzAneR+ZuUupzqnfNKLFNkkvvpqNy2WFkpR8MoZi5x6CB86LsIUR9hZF MouR9YvisXMZpijCQ6k6QCNBFJM6ez+KLQEGbPop7Z4DSDNZ9NP2mX2EGStNhfHEQsbI NVk7w1DAAzC5MXphDq4+ZkwsjT64vDL5YcoFMJ3yaLoNhwaYV99XWRS7Q1EJ6rfN3KGC wXdx3Xlq92fjJYy6groXw4HI6//Q1vmPDTCpN1zqMPiV35eYM3uNwkL98S0EyqRSIYjs 2jeGkVFdR6mRwUOLwXDTBtB1gy/2agj5/Dao56NeGYbKq793EB+t8uVaqq9+dmRMS9QH PIug== X-Gm-Message-State: APt69E2raCk3AvCPQ9iO+1NpGQAkpEhjPOpV+LXj1vd4gLGKzkHJvxhF 1/pzSCMbMmiLz5Z8wdtEQQqgZA== X-Received: by 2002:a19:ed0e:: with SMTP id y14-v6mr1873369lfy.91.1529086397755; Fri, 15 Jun 2018 11:13:17 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id h4-v6sm1543260ljc.8.2018.06.15.11.13.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jun 2018 11:13:17 -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 v3 net-next 2/6] net: ethernet: ti: cpdma: fit rated channels in backward order Date: Fri, 15 Jun 2018 21:13:06 +0300 Message-Id: <20180615181310.10437-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615181310.10437-1-ivan.khoronzhuk@linaro.org> References: <20180615181310.10437-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