All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
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 <ivan.khoronzhuk@linaro.org>
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	[thread overview]
Message-ID: <20180723212634.3219-3-ivan.khoronzhuk@linaro.org> (raw)
In-Reply-To: <20180723212634.3219-1-ivan.khoronzhuk@linaro.org>

According to TRM tx rated channels should be in 7..0 order,
so correct it.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
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 <ivan.khoronzhuk@linaro.org>
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	[thread overview]
Message-ID: <20180723212634.3219-3-ivan.khoronzhuk@linaro.org> (raw)
In-Reply-To: <20180723212634.3219-1-ivan.khoronzhuk@linaro.org>

According to TRM tx rated channels should be in 7..0 order,
so correct it.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-07-23 21:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 21:26 [PATCH v5 net-next 0/6] net: ethernet: ti: cpsw: add MQPRIO and CBS Qdisc offload Ivan Khoronzhuk
2018-07-23 21:26 ` Ivan Khoronzhuk
2018-07-23 21:26 ` [PATCH v5 net-next 1/6] net: ethernet: ti: cpsw: use cpdma channels in backward order for txq Ivan Khoronzhuk
2018-07-23 21:26   ` Ivan Khoronzhuk
2018-07-23 21:26 ` Ivan Khoronzhuk [this message]
2018-07-23 21:26   ` [PATCH v5 net-next 2/6] net: ethernet: ti: cpdma: fit rated channels in backward order Ivan Khoronzhuk
2018-07-23 21:26 ` [PATCH v5 net-next 3/6] net: ethernet: ti: cpsw: add MQPRIO Qdisc offload Ivan Khoronzhuk
2018-07-23 21:26   ` Ivan Khoronzhuk
2018-07-23 21:26 ` [PATCH v5 net-next 4/6] net: ethernet: ti: cpsw: add CBS " Ivan Khoronzhuk
2018-07-23 21:26   ` Ivan Khoronzhuk
2018-07-23 21:26 ` [PATCH v5 net-next 5/6] net: ethernet: ti: cpsw: restore shaper configuration while down/up Ivan Khoronzhuk
2018-07-23 21:26   ` Ivan Khoronzhuk
2018-07-23 21:26 ` [PATCH v5 net-next 6/6] Documentation: networking: cpsw: add MQPRIO & CBS offload examples Ivan Khoronzhuk
2018-07-23 21:26   ` Ivan Khoronzhuk
2018-07-24  3:38 ` [PATCH v5 net-next 0/6] net: ethernet: ti: cpsw: add MQPRIO and CBS Qdisc offload David Miller
2018-07-24  3:38   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723212634.3219-3-ivan.khoronzhuk@linaro.org \
    --to=ivan.khoronzhuk@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=francois.ozog@linaro.org \
    --cc=grygorii.strashko@ti.com \
    --cc=henrik@austad.us \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jesus.sanchez-palencia@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=p-varis@ti.com \
    --cc=spatton@ti.com \
    --cc=vinicius.gomes@intel.com \
    --cc=yogeshs@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.