Skip to content

Commit

Permalink
net: ethernet: ti: cpsw: simplify submit routine
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ivan Khoronzhuk authored and David S. Miller committed Aug 11, 2016
1 parent ab10dcc commit 27e9e10
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions drivers/net/ethernet/ti/cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 27e9e10

Please sign in to comment.