net: hns3: fix for not calculating TX BD send size correctly
authorYunsheng Lin <linyunsheng@huawei.com>
Tue, 21 Jul 2020 11:03:52 +0000 (19:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jul 2020 08:19:45 +0000 (10:19 +0200)
commit9d121fc033a18513d4113cc23e835d5bac264a0a
tree2decc7d3e9e90f9fdc5eb88f1f309c361ebdf37a
parent38fbcc5e58be512aa172ed3d25e8d50ade457878
net: hns3: fix for not calculating TX BD send size correctly

[ Upstream commit 48ae74c9d89f827b39b5c07a1f02fc13637a3cd6 ]

With GRO and fraglist support, the SKB can be aggregated to
a total size of 65535, and when that SKB is forwarded through
a bridge, the size of the SKB may be pushed to exceed the size
of 65535 when br_dev_queue_push_xmit() is called.

The max send size of BD supported by the HW is 65535, when a SKB
with a headlen of over 65535 is sent to the driver, the driver
needs to use multi BD to send the linear data, and the send size
of the last BD is calculated incorrectly by the driver who is
using '&' operation, which causes a TX error.

Use '%' operation to fix this problem.

Fixes: 3fe13ed95dd3 ("net: hns3: avoid mult + div op in critical data path")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h