]> git.itanic.dy.fi Git - linux-stable/commit
net: hns3: optimize the rx page reuse handling process
authorYunsheng Lin <linyunsheng@huawei.com>
Wed, 16 Jun 2021 06:36:16 +0000 (14:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Jun 2021 07:36:06 +0000 (00:36 -0700)
commitfa7711b888f24ee9291d90f8fbdaccfc80ed72c7
tree760bc9d375ca5b78ab244c9c1eddd10f1a96d283
parent7459775e9f658a2d5f3ff9d4d087e86f4d4e5b83
net: hns3: optimize the rx page reuse handling process

Current rx page offset only reset to zero when all the below
conditions are satisfied:
1. rx page is only owned by driver.
2. rx page is reusable.
3. the page offset that is above to be given to the stack has
reached the end of the page.

If the page offset is over the hns3_buf_size(), it means the
buffer below the offset of the page is usable when the above
condition 1 & 2 are satisfied, so page offset can be reset to
zero instead of increasing the offset. We may be able to always
reuse the first 4K buffer of a 64K page, which means we can
limit the hot buffer size as much as possible.

The above optimization is a side effect when refacting the
rx page reuse handling in order to support the rx copybreak.

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