linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
To: netdev@vger.kernel.org, mugunthanvnm@ti.com, grygorii.strashko@ti.com
Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	dlide@ti.com, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Subject: [PATCH v2 01/14] net: ethernet: ti: cpsw: simplify submit routine
Date: Sat,  6 Aug 2016 13:48:31 +0300	[thread overview]
Message-ID: <1470480524-6851-2-git-send-email-ivan.khoronzhuk@linaro.org> (raw)
In-Reply-To: <1470480524-6851-1-git-send-email-ivan.khoronzhuk@linaro.org>

As second net dev is created only in case of dual_emac mode, port
number can be figured out in simpler way. Also no need to pass
redundant ndev struct.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 drivers/net/ethernet/ti/cpsw.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index c51f346..8972bf6 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1065,19 +1065,11 @@ static int cpsw_common_res_usage_state(struct cpsw_priv *priv)
 	return usage_count;
 }
 
-static inline int cpsw_tx_packet_submit(struct net_device *ndev,
-			struct cpsw_priv *priv, struct sk_buff *skb)
+static inline int cpsw_tx_packet_submit(struct cpsw_priv *priv,
+					struct sk_buff *skb)
 {
-	if (!priv->data.dual_emac)
-		return cpdma_chan_submit(priv->txch, skb, skb->data,
-				  skb->len, 0);
-
-	if (ndev == cpsw_get_slave_ndev(priv, 0))
-		return cpdma_chan_submit(priv->txch, skb, skb->data,
-				  skb->len, 1);
-	else
-		return cpdma_chan_submit(priv->txch, skb, skb->data,
-				  skb->len, 2);
+	return cpdma_chan_submit(priv->txch, skb, skb->data, skb->len,
+				 priv->emac_port + priv->data.dual_emac);
 }
 
 static inline void cpsw_add_dual_emac_def_ale_entries(
@@ -1406,7 +1398,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
 
 	skb_tx_timestamp(skb);
 
-	ret = cpsw_tx_packet_submit(ndev, priv, skb);
+	ret = cpsw_tx_packet_submit(priv, skb);
 	if (unlikely(ret != 0)) {
 		cpsw_err(priv, tx_err, "desc submit failed\n");
 		goto fail;
-- 
1.9.1

  reply	other threads:[~2016-08-06 21:27 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-06 10:48 [PATCH v2 00/14] net: ethernet: ti: cpsw: split driver data and per ndev data Ivan Khoronzhuk
2016-08-06 10:48 ` Ivan Khoronzhuk [this message]
2016-08-09  8:09   ` [PATCH v2 01/14] net: ethernet: ti: cpsw: simplify submit routine Mugunthan V N
2016-08-09 11:27   ` Grygorii Strashko
2016-08-06 10:48 ` [PATCH v2 02/14] net: ethernet: ti: cpsw: remove redundant check in napi poll Ivan Khoronzhuk
2016-08-09  8:13   ` Mugunthan V N
2016-08-09 11:29   ` Grygorii Strashko
2016-08-09 12:10     ` Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 03/14] net: ethernet: ti: cpsw: remove priv from cpsw_get_slave_port() parameters list Ivan Khoronzhuk
2016-08-09  8:14   ` Mugunthan V N
2016-08-09 11:31   ` Grygorii Strashko
2016-08-06 10:48 ` [PATCH v2 04/14] net: ethernet: ti: cpsw: remove clk var from priv Ivan Khoronzhuk
2016-08-09  8:15   ` Mugunthan V N
2016-08-09 11:31   ` Grygorii Strashko
2016-08-06 10:48 ` [PATCH v2 05/14] net: ethernet: ti: cpsw: don't check slave num in runtime Ivan Khoronzhuk
2016-08-09  8:16   ` Mugunthan V N
2016-08-09 11:34   ` Grygorii Strashko
2016-08-09 12:08     ` Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 06/14] net: ethernet: ti: cpsw: create common struct to hold shared driver data Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 07/14] net: ethernet: ti: cpsw: replace pdev on dev Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 08/14] net: ethernet: ti: cpsw: move links on h/w registers to cpsw_common Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 09/14] net: ethernet: ti: cpsw: move cpdma resources " Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 10/14] net; ethernet: ti: cpsw: move irq stuff under cpsw_common Ivan Khoronzhuk
2016-08-09 15:43   ` Grygorii Strashko
2016-08-06 10:48 ` [PATCH v2 11/14] net: ethernet: ti: cpsw: move data platform data and slaves info to cpsw_common Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 12/14] net: ethernet: ti: cpsw: fix int dbg message Ivan Khoronzhuk
2016-08-06 20:24   ` Joe Perches
2016-08-06 10:48 ` [PATCH v2 13/14] net: ethernet: ti: cpsw: move napi struct to cpsw_common Ivan Khoronzhuk
2016-08-06 10:48 ` [PATCH v2 14/14] net: ethernet: ti: cpsw: move ale, cpts and drivers params under cpsw_common Ivan Khoronzhuk
2016-08-09 15:45 ` [PATCH v2 00/14] net: ethernet: ti: cpsw: split driver data and per ndev data Grygorii Strashko

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=1470480524-6851-2-git-send-email-ivan.khoronzhuk@linaro.org \
    --to=ivan.khoronzhuk@linaro.org \
    --cc=dlide@ti.com \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).