Skip to content

Commit

Permalink
net: ethernet: ti: cpsw: sync rates for channels in dual emac mode
Browse files Browse the repository at this point in the history
The channels are common for both ndevs in dual emac mode. Hence, keep
in sync their rates.

Signed-off-by: Ivan Khoronzhuk <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ikhorn authored and davem330 committed Dec 10, 2016
1 parent 0be01b8 commit 52986a2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/net/ethernet/ti/cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2020,9 +2020,10 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
{
struct cpsw_priv *priv = netdev_priv(ndev);
struct cpsw_common *cpsw = priv->cpsw;
struct cpsw_slave *slave;
u32 min_rate;
u32 ch_rate;
int ret;
int i, ret;

ch_rate = netdev_get_tx_queue(ndev, queue)->tx_maxrate;
if (ch_rate == rate)
Expand Down Expand Up @@ -2053,6 +2054,15 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
if (ret)
return ret;

/* update rates for slaves tx queues */
for (i = 0; i < cpsw->data.slaves; i++) {
slave = &cpsw->slaves[i];
if (!slave->ndev)
continue;

netdev_get_tx_queue(slave->ndev, queue)->tx_maxrate = rate;
}

cpsw_split_res(ndev);
return ret;
}
Expand Down

0 comments on commit 52986a2

Please sign in to comment.