diff options
author | Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> | 2016-12-10 13:23:50 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-12-10 23:29:47 +0100 |
commit | 52986a2f926cc0de544e32005a3436bb6db39f10 (patch) | |
tree | 3ec2a2eee1fa080ce65aadd52ce223923e11ed74 /drivers/net | |
parent | net: ethernet: ti: cpsw: re-split res only when speed is changed (diff) | |
download | linux-52986a2f926cc0de544e32005a3436bb6db39f10.tar.xz linux-52986a2f926cc0de544e32005a3436bb6db39f10.zip |
net: ethernet: ti: cpsw: sync rates for channels in dual emac mode
The channels are common for both ndevs in dual emac mode. Hence, keep
in sync their rates.
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 7ccfa635d98f..b203143647e6 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -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) @@ -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; } |