Skip to content

Commit 1ac6566

Browse files
committed
Merge: CNB95: net: page_pool: update to the v6.8
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4058 JIRA: https://issues.redhat.com/browse/RHEL-31941 Depends: !4000 Depends: !4041 The series updates page_pool to upstream version v6.8. Both have to be updated at once due to circular dependencies. Signed-off-by: Petr Oros <poros@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: Rafael Aquini <aquini@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents 5ec70fe + aac2dc1 commit 1ac6566

File tree

42 files changed

+1989
-351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1989
-351
lines changed

Documentation/netlink/specs/netdev.yaml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,112 @@ attribute-sets:
8686
See Documentation/networking/xdp-rx-metadata.rst for more details.
8787
type: u64
8888
enum: xdp-rx-metadata
89+
-
90+
name: page-pool
91+
attributes:
92+
-
93+
name: id
94+
doc: Unique ID of a Page Pool instance.
95+
type: uint
96+
checks:
97+
min: 1
98+
max: u32-max
99+
-
100+
name: ifindex
101+
doc: |
102+
ifindex of the netdev to which the pool belongs.
103+
May be reported as 0 if the page pool was allocated for a netdev
104+
which got destroyed already (page pools may outlast their netdevs
105+
because they wait for all memory to be returned).
106+
type: u32
107+
checks:
108+
min: 1
109+
max: s32-max
110+
-
111+
name: napi-id
112+
doc: Id of NAPI using this Page Pool instance.
113+
type: uint
114+
checks:
115+
min: 1
116+
max: u32-max
117+
-
118+
name: inflight
119+
type: uint
120+
doc: |
121+
Number of outstanding references to this page pool (allocated
122+
but yet to be freed pages). Allocated pages may be held in
123+
socket receive queues, driver receive ring, page pool recycling
124+
ring, the page pool cache, etc.
125+
-
126+
name: inflight-mem
127+
type: uint
128+
doc: |
129+
Amount of memory held by inflight pages.
130+
-
131+
name: detach-time
132+
type: uint
133+
doc: |
134+
Seconds in CLOCK_BOOTTIME of when Page Pool was detached by
135+
the driver. Once detached Page Pool can no longer be used to
136+
allocate memory.
137+
Page Pools wait for all the memory allocated from them to be freed
138+
before truly disappearing. "Detached" Page Pools cannot be
139+
"re-attached", they are just waiting to disappear.
140+
Attribute is absent if Page Pool has not been detached, and
141+
can still be used to allocate new memory.
142+
-
143+
name: page-pool-info
144+
subset-of: page-pool
145+
attributes:
146+
-
147+
name: id
148+
-
149+
name: ifindex
150+
-
151+
name: page-pool-stats
152+
doc: |
153+
Page pool statistics, see docs for struct page_pool_stats
154+
for information about individual statistics.
155+
attributes:
156+
-
157+
name: info
158+
doc: Page pool identifying information.
159+
type: nest
160+
nested-attributes: page-pool-info
161+
-
162+
name: alloc-fast
163+
type: uint
164+
value: 8 # reserve some attr ids in case we need more metadata later
165+
-
166+
name: alloc-slow
167+
type: uint
168+
-
169+
name: alloc-slow-high-order
170+
type: uint
171+
-
172+
name: alloc-empty
173+
type: uint
174+
-
175+
name: alloc-refill
176+
type: uint
177+
-
178+
name: alloc-waive
179+
type: uint
180+
-
181+
name: recycle-cached
182+
type: uint
183+
-
184+
name: recycle-cache-full
185+
type: uint
186+
-
187+
name: recycle-ring
188+
type: uint
189+
-
190+
name: recycle-ring-full
191+
type: uint
192+
-
193+
name: recycle-released-refcnt
194+
type: uint
89195

90196
operations:
91197
list:
@@ -120,8 +226,74 @@ operations:
120226
doc: Notification about device configuration being changed.
121227
notify: dev-get
122228
mcgrp: mgmt
229+
-
230+
name: page-pool-get
231+
doc: |
232+
Get / dump information about Page Pools.
233+
(Only Page Pools associated with a net_device can be listed.)
234+
attribute-set: page-pool
235+
do:
236+
request:
237+
attributes:
238+
- id
239+
reply: &pp-reply
240+
attributes:
241+
- id
242+
- ifindex
243+
- napi-id
244+
- inflight
245+
- inflight-mem
246+
- detach-time
247+
dump:
248+
reply: *pp-reply
249+
config-cond: page-pool
250+
-
251+
name: page-pool-add-ntf
252+
doc: Notification about page pool appearing.
253+
notify: page-pool-get
254+
mcgrp: page-pool
255+
config-cond: page-pool
256+
-
257+
name: page-pool-del-ntf
258+
doc: Notification about page pool disappearing.
259+
notify: page-pool-get
260+
mcgrp: page-pool
261+
config-cond: page-pool
262+
-
263+
name: page-pool-change-ntf
264+
doc: Notification about page pool configuration being changed.
265+
notify: page-pool-get
266+
mcgrp: page-pool
267+
config-cond: page-pool
268+
-
269+
name: page-pool-stats-get
270+
doc: Get page pool statistics.
271+
attribute-set: page-pool-stats
272+
do:
273+
request:
274+
attributes:
275+
- info
276+
reply: &pp-stats-reply
277+
attributes:
278+
- info
279+
- alloc-fast
280+
- alloc-slow
281+
- alloc-slow-high-order
282+
- alloc-empty
283+
- alloc-refill
284+
- alloc-waive
285+
- recycle-cached
286+
- recycle-cache-full
287+
- recycle-ring
288+
- recycle-ring-full
289+
- recycle-released-refcnt
290+
dump:
291+
reply: *pp-stats-reply
292+
config-cond: page-pool-stats
123293

124294
mcast-groups:
125295
list:
126296
-
127297
name: mgmt
298+
-
299+
name: page-pool

Documentation/networking/page_pool.rst

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,8 @@
44
Page Pool API
55
=============
66

7-
The page_pool allocator is optimized for the XDP mode that uses one frame
8-
per-page, but it can fallback on the regular page allocator APIs.
9-
10-
Basic use involves replacing alloc_pages() calls with the
11-
page_pool_alloc_pages() call. Drivers should use page_pool_dev_alloc_pages()
12-
replacing dev_alloc_pages().
13-
14-
API keeps track of inflight pages, in order to let API user know
15-
when it is safe to free a page_pool object. Thus, API users
16-
must run page_pool_release_page() when a page is leaving the page_pool or
17-
call page_pool_put_page() where appropriate in order to maintain correct
18-
accounting.
19-
20-
API user must call page_pool_put_page() once on a page, as it
21-
will either recycle the page, or in case of refcnt > 1, it will
22-
release the DMA mapping and inflight state accounting.
7+
.. kernel-doc:: include/net/page_pool/helpers.h
8+
:doc: page_pool allocator
239

2410
Architecture overview
2511
=====================
@@ -55,6 +41,11 @@ Architecture overview
5541
| Fast cache | | ptr-ring cache |
5642
+-----------------+ +------------------+
5743
44+
Monitoring
45+
==========
46+
Information about page pools on the system can be accessed via the netdev
47+
genetlink family (see Documentation/netlink/specs/netdev.yaml).
48+
5849
API interface
5950
=============
6051
The number of pools created **must** match the number of hardware queues
@@ -72,7 +63,9 @@ a page will cause no race conditions is enough.
7263

7364
.. kernel-doc:: include/net/page_pool/helpers.h
7465
:identifiers: page_pool_put_page page_pool_put_full_page
75-
page_pool_recycle_direct page_pool_dev_alloc_pages
66+
page_pool_recycle_direct page_pool_free_va
67+
page_pool_dev_alloc_pages page_pool_dev_alloc_frag
68+
page_pool_dev_alloc page_pool_dev_alloc_va
7669
page_pool_get_dma_addr page_pool_get_dma_dir
7770

7871
.. kernel-doc:: net/core/page_pool.c
@@ -119,8 +112,9 @@ page_pool_get_stats() and structures described below are available.
119112
It takes a pointer to a ``struct page_pool`` and a pointer to a struct
120113
page_pool_stats allocated by the caller.
121114

122-
The API will fill in the provided struct page_pool_stats with
123-
statistics about the page_pool.
115+
Older drivers expose page pool statistics via ethtool or debugfs.
116+
The same statistics are accessible via the netlink netdev family
117+
in a driver-independent fashion.
124118

125119
.. kernel-doc:: include/net/page_pool/types.h
126120
:identifiers: struct page_pool_recycle_stats
@@ -175,7 +169,7 @@ NAPI poller
175169
if XDP_DROP:
176170
page_pool_recycle_direct(page_pool, page);
177171
} else (packet_is_skb) {
178-
page_pool_release_page(page_pool, page);
172+
skb_mark_for_recycle(skb);
179173
new_page = page_pool_dev_alloc_pages(page_pool);
180174
}
181175
}

0 commit comments

Comments
 (0)