]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: fix for not calculating tx bd num correctly
authorYunsheng Lin <linyunsheng@huawei.com>
Thu, 21 Mar 2019 03:28:43 +0000 (11:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Mar 2019 20:59:24 +0000 (13:59 -0700)
commit28ea0796a77c24d632966581897e6e7fdcbe0fcc
tree8766e7d7a2619c06d7e81391db73b02f9db2c2ab
parentbb29dfe8b53e6f3d0cd503e637f183922822974c
net: hns3: fix for not calculating tx bd num correctly

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 using DIV_ROUND_UP.

Fixes: 4c6401564832 ("net: hns3: avoid mult + div op in critical data path")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h