]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/thunderx-enable-page-recycling-for-non-xdp-case.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / thunderx-enable-page-recycling-for-non-xdp-case.patch
1 From foo@baz Thu Mar 28 21:54:17 CET 2019
2 From: Dean Nelson <dnelson@redhat.com>
3 Date: Tue, 26 Mar 2019 11:53:19 -0400
4 Subject: thunderx: enable page recycling for non-XDP case
5
6 From: Dean Nelson <dnelson@redhat.com>
7
8 [ Upstream commit b3e208069477588c06f4d5d986164b435bb06e6d ]
9
10 Commit 773225388dae15e72790 ("net: thunderx: Optimize page recycling for XDP")
11 added code to nicvf_alloc_page() that inadvertently disables receive buffer
12 page recycling for the non-XDP case by always NULL'ng the page pointer.
13
14 This patch corrects two if-conditionals to allow for the recycling of non-XDP
15 mode pages by only setting the page pointer to NULL when the page is not ready
16 for recycling.
17
18 Fixes: 773225388dae ("net: thunderx: Optimize page recycling for XDP")
19 Signed-off-by: Dean Nelson <dnelson@redhat.com>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 ---
23 drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 23 ++++++++++-----------
24 1 file changed, 11 insertions(+), 12 deletions(-)
25
26 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
27 +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
28 @@ -105,20 +105,19 @@ static inline struct pgcache *nicvf_allo
29 /* Check if page can be recycled */
30 if (page) {
31 ref_count = page_ref_count(page);
32 - /* Check if this page has been used once i.e 'put_page'
33 - * called after packet transmission i.e internal ref_count
34 - * and page's ref_count are equal i.e page can be recycled.
35 + /* This page can be recycled if internal ref_count and page's
36 + * ref_count are equal, indicating that the page has been used
37 + * once for packet transmission. For non-XDP mode, internal
38 + * ref_count is always '1'.
39 */
40 - if (rbdr->is_xdp && (ref_count == pgcache->ref_count))
41 - pgcache->ref_count--;
42 - else
43 - page = NULL;
44 -
45 - /* In non-XDP mode, page's ref_count needs to be '1' for it
46 - * to be recycled.
47 - */
48 - if (!rbdr->is_xdp && (ref_count != 1))
49 + if (rbdr->is_xdp) {
50 + if (ref_count == pgcache->ref_count)
51 + pgcache->ref_count--;
52 + else
53 + page = NULL;
54 + } else if (ref_count != 1) {
55 page = NULL;
56 + }
57 }
58
59 if (!page) {