aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti
diff options
context:
space:
mode:
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-08-09 19:22:32 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-10 20:27:38 -0400
commit27e9e10391259cbe2e52d6f0ac5b16b1d898d901 (patch)
treed40219dbdcf6c0b54a66c91858061b6e3e27a286 /drivers/net/ethernet/ti
parentab10dccb11608b96b43b557c12a5ad867723e503 (diff)
net: ethernet: ti: cpsw: simplify submit routine
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti')
-rw-r--r--drivers/net/ethernet/ti/cpsw.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index c51f34693eae..8972bf6870ed 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)
1065 return usage_count; 1065 return usage_count;
1066} 1066}
1067 1067
1068static inline int cpsw_tx_packet_submit(struct net_device *ndev, 1068static inline int cpsw_tx_packet_submit(struct cpsw_priv *priv,
1069 struct cpsw_priv *priv, struct sk_buff *skb) 1069 struct sk_buff *skb)
1070{ 1070{
1071 if (!priv->data.dual_emac) 1071 return cpdma_chan_submit(priv->txch, skb, skb->data, skb->len,
1072 return cpdma_chan_submit(priv->txch, skb, skb->data, 1072 priv->emac_port + priv->data.dual_emac);
1073 skb->len, 0);
1074
1075 if (ndev == cpsw_get_slave_ndev(priv, 0))
1076 return cpdma_chan_submit(priv->txch, skb, skb->data,
1077 skb->len, 1);
1078 else
1079 return cpdma_chan_submit(priv->txch, skb, skb->data,
1080 skb->len, 2);
1081} 1073}
1082 1074
1083static inline void cpsw_add_dual_emac_def_ale_entries( 1075static 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,
1406 1398
1407 skb_tx_timestamp(skb); 1399 skb_tx_timestamp(skb);
1408 1400
1409 ret = cpsw_tx_packet_submit(ndev, priv, skb); 1401 ret = cpsw_tx_packet_submit(priv, skb);
1410 if (unlikely(ret != 0)) { 1402 if (unlikely(ret != 0)) {
1411 cpsw_err(priv, tx_err, "desc submit failed\n"); 1403 cpsw_err(priv, tx_err, "desc submit failed\n");
1412 goto fail; 1404 goto fail;