• Ivan Khoronzhuk's avatar
    net: ethernet: ti: cpsw: add .ndo to set per-queue rate · 83fcad0c
    Ivan Khoronzhuk authored
    This patch allows to rate limit queues tx queues for cpsw interface.
    The rate is set in absolute Mb/s units and cannot be more a speed
    an interface is connected with.
    
    The rate for a tx queue can be tested with:
    
    ethtool -L eth0 rx 4 tx 4
    
    echo 100 > /sys/class/net/eth0/queues/tx-0/tx_maxrate
    echo 200 > /sys/class/net/eth0/queues/tx-1/tx_maxrate
    echo 50 > /sys/class/net/eth0/queues/tx-2/tx_maxrate
    echo 30 > /sys/class/net/eth0/queues/tx-3/tx_maxrate
    
    tc qdisc add dev eth0 root handle 1: multiq
    
    tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip\
    dport 5001 0xffff action skbedit queue_mapping 0
    
    tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip\
    dport 5002 0xffff action skbedit queue_mapping 1
    
    tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip\
    dport 5003 0xffff action skbedit queue_mapping 2
    
    tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip\
    dport 5004 0xffff action skbedit queue_mapping 3
    
    iperf -c 192.168.2.1 -b 110M -p 5001 -f m -t 60
    iperf -c 192.168.2.1 -b 215M -p 5002 -f m -t 60
    iperf -c 192.168.2.1 -b 55M -p 5003 -f m -t 60
    iperf -c 192.168.2.1 -b 32M -p 5004 -f m -t 60
    Signed-off-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    83fcad0c
cpsw.c 80.9 KB