]> git.itanic.dy.fi Git - linux-stable/commit
net: hns3: use bounce buffer when rx page can not be reused
authorYunsheng Lin <linyunsheng@huawei.com>
Wed, 16 Jun 2021 06:36:17 +0000 (14:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Jun 2021 07:36:06 +0000 (00:36 -0700)
commit99f6b5fb5f63cf69c6e56bba8e5492c98c521a63
tree372df4e19c059d3f1fcec95a4094b5daf3af85fb
parentfa7711b888f24ee9291d90f8fbdaccfc80ed72c7
net: hns3: use bounce buffer when rx page can not be reused

Currently rx page will be reused to receive future packet when
the stack releases the previous skb quickly. If the old page
can not be reused, a new page will be allocated and mapped,
which comsumes a lot of cpu when IOMMU is in the strict mode,
especially when the application and irq/NAPI happens to run on
the same cpu.

So allocate a new frag to memcpy the data to avoid the costly
IOMMU unmapping/mapping operation, and add "frag_alloc_err"
and "frag_alloc" stats in "ethtool -S ethX" cmd.

The throughput improves above 50% when running single thread of
iperf using TCP when IOMMU is in strict mode and iperf shares the
same cpu with irq/NAPI(rx_copybreak = 2048 and mtu = 1500).

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