• Zh-yuan Ye's avatar
    net: cbs: Fix software cbs to consider packet sending time · 961d0e5b
    Zh-yuan Ye authored
    Currently the software CBS does not consider the packet sending time
    when depleting the credits. It caused the throughput to be
    Idleslope[kbps] * (Port transmit rate[kbps] / |Sendslope[kbps]|) where
    Idleslope * (Port transmit rate / (Idleslope + |Sendslope|)) = Idleslope
    is expected. In order to fix the issue above, this patch takes the time
    when the packet sending completes into account by moving the anchor time
    variable "last" ahead to the send completion time upon transmission and
    adding wait when the next dequeue request comes before the send
    completion time of the previous packet.
    
    changelog:
    V2->V3:
     - remove unnecessary whitespace cleanup
     - add the checks if port_rate is 0 before division
    
    V1->V2:
     - combine variable "send_completed" into "last"
     - add the comment for estimate of the packet sending
    
    Fixes: 585d763a ("net/sched: Introduce Credit Based Shaper (CBS) qdisc")
    Signed-off-by: default avatarZh-yuan Ye <ye.zh-yuan@socionext.com>
    Reviewed-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    961d0e5b
sch_cbs.c 13.7 KB