• Grygorii Strashko's avatar
    net: ethernet: ti: am65-cpsw: add mqprio qdisc offload in channel mode · 90bc21aa
    Grygorii Strashko authored
    This patch adds MQPRIO Qdisc offload in full 'channel' mode which allows
    not only setting up pri:tc mapping, but also configuring TX shapers on
    external port FIFOs. The K3 CPSW MQPRIO Qdisc offload is expected to work
    with VLAN/priority tagged packets. Non-tagged packets have to be mapped
    only to TC0.
    
    - TX traffic classes must be rated starting from TC that has highest
    priority and with no gaps
    - Traffic classes are used starting from 0, that has highest priority
    - min_rate defines Committed Information Rate (guaranteed)
    - max_rate defines Excess Information Rate (non guaranteed) and offloaded
    as (max_rate[i] - tcX_min_rate[i])
    - VLAN/priority tagged packets mapped to TC0 will exit switch with VLAN tag
    priority 0
    
    The configuration example:
     ethtool -L eth1 tx 5
     ethtool --set-priv-flags eth1 p0-rx-ptype-rrobin off
    
     tc qdisc add dev eth1 parent root handle 100: mqprio num_tc 3 \
     map 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 \
     queues 1@0 1@1 1@2 hw 1 mode channel \
     shaper bw_rlimit min_rate 0 100mbit 200mbit max_rate 0 101mbit 202mbit
    
     tc qdisc replace dev eth2 handle 100: parent root mqprio num_tc 1 \
     map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues 1@0 hw 1
    
     ip link add link eth1 name eth1.100 type vlan id 100
     ip link set eth1.100 type vlan egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
    
    In the above example two ports share the same TX CPPI queue 0 for low
    priority traffic. 3 traffic classes are defined for eth1 and mapped to:
    TC0 - low priority, TX CPPI queue 0 -> ext Port 1 fifo0, no rate limit
    TC1 - prio 2, TX CPPI queue 1 -> ext Port 1 fifo1, CIR=100Mbit/s, EIR=1Mbit/s
    TC2 - prio 3, TX CPPI queue 2 -> ext Port 1 fifo2, CIR=200Mbit/s, EIR=2Mbit/s
    Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    90bc21aa
am65-cpsw-qos.h 1.39 KB