]> git.itanic.dy.fi Git - linux-stable/commit
net: hns3: support dma_map_sg() for multi frags skb
authorYunsheng Lin <linyunsheng@huawei.com>
Wed, 16 Jun 2021 06:36:15 +0000 (14:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Jun 2021 07:36:06 +0000 (00:36 -0700)
commit7459775e9f658a2d5f3ff9d4d087e86f4d4e5b83
tree3bb90da3012bca45f572fa62565a2c7d4870c9b5
parent1a00197b7d2fe57f0be93037d5090e19a9b178c8
net: hns3: support dma_map_sg() for multi frags skb

Using the queue based tx buffer, it is also possible to allocate a
sgl buffer, and use skb_to_sgvec() to convert the skb to the sgvec
in order to support the dma_map_sg() to decreases the overhead of
IOMMU mapping and unmapping.

Firstly, it reduces the number of buffers. For example, a tcp skb
may have a 66-byte header and 3 fragments of 4328, 32768, and 28064
bytes. With this patch, dma_map_sg() will combine them into two
buffers, 66-bytes header and one 65160-bytes fragment by using IOMMU.

Secondly, it reduces the number of dma mapping and unmapping. All the
original 4 buffers are mapped only once rather than 4 times.

The throughput improves above 10% when running single thread of iperf
using TCP when IOMMU is in strict mode.

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_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c