From patchwork Fri May 18 21:15:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 10412207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFBD460230 for ; Fri, 18 May 2018 21:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB5A028AB7 for ; Fri, 18 May 2018 21:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF4D528AF1; Fri, 18 May 2018 21:15:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7598228AB7 for ; Fri, 18 May 2018 21:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752206AbeERVPX (ORCPT ); Fri, 18 May 2018 17:15:23 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:44023 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752129AbeERVPU (ORCPT ); Fri, 18 May 2018 17:15:20 -0400 Received: by mail-lf0-f66.google.com with SMTP id n18-v6so15864252lfh.10 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=pRyfCRKGeZBtIJz/+Xfo7MSjI2F5e2jgV+31bvCK1fcvMun8TyIMVB/LuJCjalEdHQ vS5EnbLfeOtZ0phroxiFgOs1gsBIWYE/OEfty0vgl8JYxSAFd4FuXo5aZ25cWc2OHJlx O8sHED/ES7zsSQTYCIPIz522GCe7YoQlF48IhyswnOERuBiaAaocUBcuVMuxlr8w83Zt G7e7ZrNGAIu7Dg45V+hjddvV0HyhhfSp2OaKgMx742V7sa3Egh41qwXp+9kAewiu4dGT dXGqsOr+p63NZ7OWwC8LemCi2rXNmbvUMEuS4ZcRRJ+/0qDCo1mVheCv/eQvqwGUtbQE B+FA== X-Gm-Message-State: ALKqPwfqvmUbktMEFDJmF6RVVC69WMEZeCeGd3fZG0EGgmqxz2y9YRzx tJ35WP2rTUtdjd2c6tJ/gGBsmQ== X-Google-Smtp-Source: AB8JxZp3kRmfbeeLsZcY4p/VEAxU7uk2U6XZKlXQYw962tlodg2j8BA9h2ZIUY1D01p6tTASoHEwDQ== 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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,