mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-04 19:54:03 +08:00
thunderx: enable page recycling for non-XDP case
Commit773225388d
("net: thunderx: Optimize page recycling for XDP") added code to nicvf_alloc_page() that inadvertently disables receive buffer page recycling for the non-XDP case by always NULL'ng the page pointer. This patch corrects two if-conditionals to allow for the recycling of non-XDP mode pages by only setting the page pointer to NULL when the page is not ready for recycling. Fixes:773225388d
("net: thunderx: Optimize page recycling for XDP") Signed-off-by: Dean Nelson <dnelson@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7f07e5f1f7
commit
b3e2080694
@ -105,20 +105,19 @@ static inline struct pgcache *nicvf_alloc_page(struct nicvf *nic,
|
|||||||
/* Check if page can be recycled */
|
/* Check if page can be recycled */
|
||||||
if (page) {
|
if (page) {
|
||||||
ref_count = page_ref_count(page);
|
ref_count = page_ref_count(page);
|
||||||
/* Check if this page has been used once i.e 'put_page'
|
/* This page can be recycled if internal ref_count and page's
|
||||||
* called after packet transmission i.e internal ref_count
|
* ref_count are equal, indicating that the page has been used
|
||||||
* and page's ref_count are equal i.e page can be recycled.
|
* once for packet transmission. For non-XDP mode, internal
|
||||||
|
* ref_count is always '1'.
|
||||||
*/
|
*/
|
||||||
if (rbdr->is_xdp && (ref_count == pgcache->ref_count))
|
if (rbdr->is_xdp) {
|
||||||
pgcache->ref_count--;
|
if (ref_count == pgcache->ref_count)
|
||||||
else
|
pgcache->ref_count--;
|
||||||
page = NULL;
|
else
|
||||||
|
page = NULL;
|
||||||
/* In non-XDP mode, page's ref_count needs to be '1' for it
|
} else if (ref_count != 1) {
|
||||||
* to be recycled.
|
|
||||||
*/
|
|
||||||
if (!rbdr->is_xdp && (ref_count != 1))
|
|
||||||
page = NULL;
|
page = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
Loading…
Reference in New Issue
Block a user