Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1459187

[PATCH v3 01/13] net: ethernet: ti: cpsw: simplify submit routine

From Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v3 01/13] net: ethernet: ti: cpsw: simplify submit routine
Date 2016-08-10 01:30 +0200
Message-ID <s4oD8-5EB-51@gated-at.bofh.it> (permalink)
References <s4oD7-5EB-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/13] net: ethernet: ti: cpsw: split driver data and per ndev data Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-10 01:30 +0200
  [PATCH v3 01/13] net: ethernet: ti: cpsw: simplify submit routine Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-10 01:30 +0200
  [PATCH v3 06/13] net: ethernet: ti: cpsw: create common struct to hold shared driver data Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-10 01:30 +0200
  [PATCH v3 13/13] net: ethernet: ti: cpsw: move ale, cpts and drivers params under cpsw_common Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-10 01:30 +0200
    Re: [PATCH v3 13/13] net: ethernet: ti: cpsw: move ale, cpts and  drivers params under cpsw_common Mugunthan V N <mugunthanvnm@ti.com> - 2016-08-10 20:10 +0200
  [PATCH v3 12/13] net: ethernet: ti: cpsw: move napi struct to cpsw_common Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-10 01:30 +0200
    Re: [PATCH v3 12/13] net: ethernet: ti: cpsw: move napi struct to  cpsw_common Mugunthan V N <mugunthanvnm@ti.com> - 2016-08-10 20:10 +0200
  Re: [PATCH v3 00/13] net: ethernet: ti: cpsw: split driver data and  per ndev data Grygorii Strashko <grygorii.strashko@ti.com> - 2016-08-10 23:20 +0200

csiph-web