From patchwork Sat Jul 21 11:59:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 142493 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4012001ljj; Sat, 21 Jul 2018 04:59:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdUrpC4U8B/l0shy9iVYJjpi46+xkactvd2vqpzZjjPA5A/PSpBEJqX50ORvvQxA4I2/hsU X-Received: by 2002:a63:f616:: with SMTP id m22-v6mr5300336pgh.293.1532174381473; Sat, 21 Jul 2018 04:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532174381; cv=none; d=google.com; s=arc-20160816; b=y88EYLbxgd9teXoUveZCQDeCwCqKb0rryNoNN/SghNZE9h+w/LlKme8vrJiDxS9270 NiAxNMyFXmg0yr9AsQgeVMFqYvtDcJIiFQ1g6RFcPcxK2S7eVSpaWZJM2bAXLmpOi58C rf/FgXU5fB6qtlIgd/gO9vWZByMiM91e3JZ7ak6o48fkNPZdzBbBQdr0lqEa8ZSCrVPc b+VYCMFdv10VpDeC4t0bNEp5iSVuDwRJHydxr1gS5Vrdx5npZ0oGpafCz8PtojJS821n dwjUvX0NN8Bi0/oNwaJjnvpMgU/j/qKPuDyk8Id3/WKIpsOUItxc2KXWaM0dnQsMraVo bwNw== 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=J0gNx+HMMc7tXkTsJONncvK4d9iP3vDtXPedoLleIHE=; b=fX/QezXXPOdQtGvPn0gb1cgLzlRxASJzbQfQsuK9JApBc97kYUDcU5FLqPYmKtv+9p 7lR0gTgjV+Mpbr8eIQI07AS+eFzjogiwRs2J/jI/GWew0uihvsAOmc3yBotLfxIcInPc 0K9y37zK3DtSFgFcwkS59woBq/AoF7Rw+ANTIM/hBd1m+O6wnEAfhUcTTrUy/UoIvMa0 wMNBGorXeFMbCzrBbqJ+I4rUj2T4FI9+uQZWZHHnK05PVqnXwK+QOW9M/cDX8QkfnNG7 AF4urDgYiIMd5JPruYF1+kV1QkzjtpsyPxtzc+Ka20wkIfhRJhPFkyjJmwUfgtknZ/V/ QmNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bWsVoDny; 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 7-v6si2980743pll.369.2018.07.21.04.59.41; Sat, 21 Jul 2018 04:59:41 -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=bWsVoDny; 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 S1728101AbeGUMwH (ORCPT + 31 others); Sat, 21 Jul 2018 08:52:07 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37132 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727960AbeGUMwG (ORCPT ); Sat, 21 Jul 2018 08:52:06 -0400 Received: by mail-lf1-f68.google.com with SMTP id j8-v6so3474548lfb.4 for ; Sat, 21 Jul 2018 04:59:36 -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=J0gNx+HMMc7tXkTsJONncvK4d9iP3vDtXPedoLleIHE=; b=bWsVoDnyCcM+fPbyUSRxA86ssLvb4p+TrvXBvjbLSRf6x+gnRdEADpWM7h4HhBURXv cH6nyQ2DLggqslRXB3arPdAf0GNmb0TRYOzscgVbKbT/R46KOvwqyCHXzQ92qzH2xWvn RSxfNPxFFr2ia0Au4YgkbvfL8e28JwbIbL0AQ= 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=J0gNx+HMMc7tXkTsJONncvK4d9iP3vDtXPedoLleIHE=; b=dPG/s+ZyKl6gNG4YcagWUJkF57l8MBdi48ualz35uObc+VqwXIso5Yp/suIVQZhqDr T8PZGgM1eYjRVFFajJZBcDXU0mrZnKTZaqUzhgs+QMWH7V74EKczMybgY0iAP+ERbxOu LXAsIIVm2XS00VqWustmbIMaHKpTK90XnFPWpZp/lGgKdIAxqdLVY+r4hakHOuzZvPac 3aGLYiyADxwL8Um6nwEIPL6o4+2zcXqK0JcNYsivhsB0aJxzLW2Ww3sMF2rtiqDzno/L gGEDjK8cIywBkh+TIKn7JareiY0QUocwR6DzgdizAgDAWsV06QIK8zpW/tHzYP+jarbe nv5A== X-Gm-Message-State: AOUpUlHgN8eAh1wILy6cPnGNwCYExRuu/g1M66C0AJkFWB4Pc7dEFY+r ZmNFdWZavaSV4OfGlS6im1W/uw== X-Received: by 2002:a19:a111:: with SMTP id k17-v6mr3261804lfe.131.1532174375716; Sat, 21 Jul 2018 04:59:35 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id 73-v6sm664260lfs.44.2018.07.21.04.59.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 04:59:35 -0700 (PDT) From: Ivan Khoronzhuk To: davem@davemloft.net, grygorii.strashko@ti.com 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 v4 net-next 2/6] net: ethernet: ti: cpdma: fit rated channels in backward order Date: Sat, 21 Jul 2018 14:59:19 +0300 Message-Id: <20180721115923.1389-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180721115923.1389-1-ivan.khoronzhuk@linaro.org> References: <20180721115923.1389-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. Reviewed-by: Grygorii Strashko 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 4f1267477aa4..4236dcdd5634 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,