From patchwork Mon Jun 11 13:30:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 138238 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4064594lji; Mon, 11 Jun 2018 06:31:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK+EelJmwOGkgydpyBM7Z5OFXl3sV9+Ez65gLF3NEVtleyq0t0ybxZDZCtW1wKyd2XhubkN X-Received: by 2002:a17:902:854a:: with SMTP id d10-v6mr18749261plo.106.1528723867851; Mon, 11 Jun 2018 06:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528723867; cv=none; d=google.com; s=arc-20160816; b=zn7w8jb11Ju7h4viygmGLXUtGTCLgJVU5G6jZedywgTcuiYhTmzkYIFZcC6tGmQSv6 QGwRtvdrigzDrO3rMWTnnMa1kO6nQF1ylqAX7AQDDT02jndyx47wll3sixTA9iJDYdJ3 C/kLWUS2NpS+IDUodeJ/ikf4uQTQe6+A6aDbChmtQO5PyHYY3rN7M6hUl4VCbt1KZagJ 4jz/PJaBFBwqXg1D7RoctGtcmxNDIYv+5GXT7ZhndArnA4J72loEWTOpF4rMlaOKnbkY g3T6lVAalpJhFSH3rG0UALJRRwsuiR5hIHFwgYLqsYSKx5IfSdFX02bjr7JCQB60oCoA 3UCg== 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=X3K5ETG8G9ZiHtF1oVfRjlId3EyZNjPp6bkIOlgA4VTxdRARvbApyklxL1eKkAxYYn /ELF0om/7vrIjWXaZiWJIMVYCbSvwOQyLn/Rb0Y6DHgLROfS2aWd64TISnLxgvY+SQe5 Ag780SCC7Qbn83gQ6MoF11PrwC7Jq68ZpNh8kWsTtbqXTy5yyFGhf2b57TBJ/E+cgv5d 50XAfdWJM+XtmCn1nxoQflExkjvkz+vuSuufRxQkKSoV0vvqMmgBbhIiNHbJEBqVjciF ugnRtZ0qqGgidbrdtmrJJA1UF6dGdK6iWUk0uf+h5XXPiTmraW1ezk21/Va25i0TrC+A V4ZQ== 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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 b10-v6si64961682pla.282.2018.06.11.06.31.07; Mon, 11 Jun 2018 06:31:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1754254AbeFKNbF (ORCPT + 9 others); Mon, 11 Jun 2018 09:31:05 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35883 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754229AbeFKNbA (ORCPT ); Mon, 11 Jun 2018 09:31:00 -0400 Received: by mail-lf0-f67.google.com with SMTP id u4-v6so30586540lff.3 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=gRf2dhTruB733AKe5+wpyh3T/c/Nhu+Gp6s2s6zsgUa5OacYXvxOQJ/0neFLnGvNEb H8VjxQIVx4NYxDEN7Szpl9m04GZJ7Rj4+ZdzxP0IponoFbuVPbGZSaXbQf2vyUhN28IL RebtUqoCAdfCMsaFkr683A10XCCPHxrm6+gymMMCwSlNLNMBOiQvm9cX+MIhtFU3gH51 Ui1BJAXnw9+QSIXT5jegk2C2vG7fJ715vwDLxDPnKanAaBG02c/mkTvMOOkRzH9afkIP NPaOAdK405ze90QbuLPvcO5z9k+wh32P5yE42cTRj+Z02GB4nnJ7xpkYdCqUcyhZbvzF IZzQ== X-Gm-Message-State: APt69E1k29PPwdE2NqfsICgjZM1bVlDIidXdJdVBvEjWDxN2rBq0KQNg Hnx3nm9/Toc/CybFZoRX7W1/SA== 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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(-) -- 2.17.1 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,