• Guangbin Huang's avatar
    net: hns3: modify mac statistics update process for compatibility · 0bd7e894
    Guangbin Huang authored
    After querying mac statistics from firmware, driver copies data from
    descriptors to struct mac_stats of hdev, and the number of copied data
    is just according to the register number queried from firmware. There is
    a problem that if the register number queried from firmware is larger
    than data number of struct mac_stats, it will cause a copy overflow.
    
    So if the firmware adds more mac statistics in later version, it is not
    compatible with driver of old version.
    
    To fix this problem, the number of copied data needs to be used the
    minimum value between the register number queried from firmware and
    data number of struct mac_stats.
    
    The first descriptor has three data and there is one reserved, to
    optimize the copy process, add this reserverd data to struct mac_stats.
    Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    0bd7e894
hclge_main.c 348 KB