Commit 27e9e103 authored by Ivan Khoronzhuk's avatar Ivan Khoronzhuk Committed by David S. Miller

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: default avatarMugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ab10dccb
...@@ -1065,19 +1065,11 @@ static int cpsw_common_res_usage_state(struct cpsw_priv *priv) ...@@ -1065,19 +1065,11 @@ static int cpsw_common_res_usage_state(struct cpsw_priv *priv)
return usage_count; return usage_count;
} }
static inline int cpsw_tx_packet_submit(struct net_device *ndev, static inline int cpsw_tx_packet_submit(struct cpsw_priv *priv,
struct cpsw_priv *priv, struct sk_buff *skb) struct sk_buff *skb)
{ {
if (!priv->data.dual_emac) return cpdma_chan_submit(priv->txch, skb, skb->data, skb->len,
return cpdma_chan_submit(priv->txch, skb, skb->data, priv->emac_port + priv->data.dual_emac);
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);
} }
static inline void cpsw_add_dual_emac_def_ale_entries( 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, ...@@ -1406,7 +1398,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
ret = cpsw_tx_packet_submit(ndev, priv, skb); ret = cpsw_tx_packet_submit(priv, skb);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
cpsw_err(priv, tx_err, "desc submit failed\n"); cpsw_err(priv, tx_err, "desc submit failed\n");
goto fail; goto fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment