net: hns3: fix for not calculating tx bd num correctly
mainline inclusion
from mainline-5.1-rc1
commit 5f543a54eec08228ab0cc0a49cf5d79dd32c9e5e
category: bugfix
bugzilla: NA
CVE: NA
-------------------------------------------------
When there is only one byte in a frag, the current calculation
using "(size + HNS3_MAX_BD_SIZE - 1) >> HNS3_MAX_BD_SIZE_OFFSET"
will return zero, because HNS3_MAX_BD_SIZE is 65535 and
HNS3_MAX_BD_SIZE_OFFSET is 16. So it will cause tx error when
a frag's size is one byte.
This patch fixes it by restoring the calculation back to
((S) + HNS3_MAX_BD_SIZE - 1) / HNS3_MAX_BD_SIZE.
Fixes: 3fe13ed95dd3 ("net: hns3: avoid mult + div op in critical data path")
Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
[hanjun: rebase to hulk-4.19 kernel]
Signed-off-by: NHanjun Guo <guohanjun@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Showing
想要评论请 注册 或 登录