Re: [PATCH net] net: hns3: fix for not calculating tx bd num correctly

From: David Miller
Date: Thu Mar 21 2019 - 17:00:07 EST


From: l00371289 <linyunsheng@xxxxxxxxxx>
Date: Thu, 21 Mar 2019 11:28:43 +0800

> From: Yunsheng Lin <linyunsheng@xxxxxxxxxx>
>
> 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: 3fe13ed95dd3 ("net: hns3: avoid mult + div op in critical data path")
> Signed-off-by: Yunsheng Lin <linyunsheng@xxxxxxxxxx>

Applied.