]> git.itanic.dy.fi Git - linux-stable/commit
net: hns3: use tx bounce buffer for small packets
authorYunsheng Lin <linyunsheng@huawei.com>
Wed, 16 Jun 2021 06:36:13 +0000 (14:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Jun 2021 07:36:06 +0000 (00:36 -0700)
commit907676b130711fd1f627824559e92259db2061d1
treeb5a7a41d1f7c3194ea21d216aa2b716d53078ef5
parent8677d78c3d860c156ccd335e2b97728298c2cbb1
net: hns3: use tx bounce buffer for small packets

when the packet or frag size is small, it causes both security and
performance issue. As dma can't map sub-page, this means some extra
kernel data is visible to devices. On the other hand, the overhead
of dma map and unmap is huge when IOMMU is on.

So add a queue based tx shared bounce buffer to memcpy the small
packet when the len of the xmitted skb is below tx_copybreak.
Add tx_spare_buf_size module param to set the size of tx spare
buffer, and add set/get_tunable to set or query the tx_copybreak.

The throughtput improves from 30 Gbps to 90+ Gbps when running 16
netperf threads with 32KB UDP message size when IOMMU is in the
strict mode(tx_copybreak = 2000 and mtu = 1500).

Suggested-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c