Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6255186imm; Mon, 23 Jul 2018 14:29:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeyJ9i7MxHPAYrby8js6wfbckgnCNj+Kk5ML/xYFINId/lxnF4Ls/cOjQVsTsx8yva/BdTc X-Received: by 2002:a17:902:548f:: with SMTP id e15-v6mr14381999pli.317.1532381354378; Mon, 23 Jul 2018 14:29:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532381354; cv=none; d=google.com; s=arc-20160816; b=08IIsMV8xzIbIjIqBEpll5SgjtsnP9wLRi/X6lToYTUSGDjGwQCWQFoWUBynxtj68z tWmWwB+SHxI896WRhDSmIKGmw4hEZDB9aIc7PGIOC5mdwTkMQpm1Q0b+yAgNGOe2s4tW hd0IR5ODvtK227I9dh/nGdG0vqXLFzreTivFSSLhbrP9pN/ydK8mhlkqrHq4dk0keDAo VYuB3s3zQIQ1JPscPJi3nhvrfmjb0ocrUdLtPlZIdOjEH9Gss4yHO5D73LvQYQS8Qh1P Jz125/NFGSmLdTfsvuSiFAKI5XWK2ZjzFaCS8SYFvQuR6W4EI1FLqKsIJWBkdkps/ZWj Kmww== 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=yBVsh6ID+PsAyzotZUt/Xk6nH1yT1g8qCa+S1iZw298=; b=bqaW5B6nU7BQk0CX9+Rt/ZN33Ddh76Yj3ChPQPJu26stXV0WSBJjLzU2pGI9XltMgl Pr4KpI29nvxQRZ5eLM4DRBlO7DD+RyjWcsTrTsmkmVGMPVIPIoiq5P4agjxWkRAX8AAE k2BXqTRG0nDZT1Hx3aOiH8jBAJYwKGGtCORN7cYHS1G7OlkOTaOyFxfhSEc05uZUBgoE XVJ9sKYjFKUEgzabthAuRIlr+NrcIITKZeztx079lgCnOH3wVzeshzolhevwjAW6SpE8 NKsUk+aw3bq7Curud/q1OYHWSxAQaDR+9AFabgY2KzQj8PzE+xl62ru+1roIxDfVlmFj VDKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IVwy7TG7; 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 h16-v6si2425317plr.445.2018.07.23.14.28.59; Mon, 23 Jul 2018 14:29:14 -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=IVwy7TG7; 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 S2388255AbeGWW37 (ORCPT + 99 others); Mon, 23 Jul 2018 18:29:59 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:35467 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388216AbeGWW36 (ORCPT ); Mon, 23 Jul 2018 18:29:58 -0400 Received: by mail-lf1-f65.google.com with SMTP id f18-v6so1507577lfc.2 for ; Mon, 23 Jul 2018 14:26:51 -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=yBVsh6ID+PsAyzotZUt/Xk6nH1yT1g8qCa+S1iZw298=; b=IVwy7TG7ftfrIEfjwsj/F+Zs7DcjFkdRg1aF2AsiZa4KZsvpJDZSPdOcTxk03eWroy pb/wrVUTfAhSh4txJ2bPUixtqVFctE+Zpi3bW8eUsKd871JtGej67yrPqafOVaczI1cu PuGW6rDhsb7B6byBwmfOaBXQXR4hRoCJq+3Kw= 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=yBVsh6ID+PsAyzotZUt/Xk6nH1yT1g8qCa+S1iZw298=; b=fxTPdjTE2Xq9NU9mR7cnx6EQ4bareZG6nAV3DiOPYb/6BSbvSIZPMEDvdibSk5rC9l /zv6Dw+WhSNiaDvrS5Bm/oHZSqjbeQywi5agVdgEYXEj5nKWJbK4i/m01Q8DINZTAzTl 3M46HtAsVQ1dDZlu+1tb8c9CEStNdAQW2doismcoc+US4q0HMmRoPZ2gRDxAJlTtVGDG GJhXqW+Bj8+OH9j88cvt/9/RPDTjfu74Ya20FaNG7grc5eMPAoCmTCBUDMJ5/WY83TG/ BMAahLE30CJP48TRkMrxg+I7Gaeua2gpm8INRKPGXVYYtvUykJI07iDTSvuIZWQAzzah O5dQ== X-Gm-Message-State: AOUpUlFsCxNKHpkHi2/5sk23EEEKwtdMyvGf4h0/RJN1B1QdmolOyNO6 DW6MS+z7kM/lCazen6OFNi9lDQ== X-Received: by 2002:a19:9fc8:: with SMTP id i191-v6mr7992213lfe.79.1532381210944; Mon, 23 Jul 2018 14:26:50 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id q4-v6sm1990435ljh.36.2018.07.23.14.26.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 14:26:50 -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 v5 net-next 2/6] net: ethernet: ti: cpdma: fit rated channels in backward order Date: Tue, 24 Jul 2018 00:26:30 +0300 Message-Id: <20180723212634.3219-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723212634.3219-1-ivan.khoronzhuk@linaro.org> References: <20180723212634.3219-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: Ilias Apalodimas Reviewed-by: Grygorii Strashko 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 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, -- 2.17.1