• Yonglong Liu's avatar
    net: hns3: fix shaper parameter algorithm · 1a92497d
    Yonglong Liu authored
    Currently when hns3 driver configures the tm shaper to limit
    bandwidth below 20Mbit using the parameters calculated by
    hclge_shaper_para_calc(), the actual bandwidth limited by tm
    hardware module is not accurate enough, for example, 1.28 Mbit
    when the user is configuring 1 Mbit.
    
    This patch adjusts the ir_calc to be closer to ir, and
    always calculate the ir_b parameter when user is configuring
    a small bandwidth. Also, removes an unnecessary parenthesis
    when calculating denominator.
    
    Fixes: 84844054 ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver")
    Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
    Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1a92497d
hclge_tm.c 32.8 KB