Commit 3804fea
bpf: Support pulling non-linear xdp data
Add kfunc, bpf_xdp_pull_data(), to support pulling data from xdp
fragments. Similar to bpf_skb_pull_data(), bpf_xdp_pull_data() makes
the first len bytes of data directly readable and writable in bpf
programs. If the "len" argument is larger than the linear data size,
data in fragments will be copied to the linear region when there
is enough room between xdp->data_end and xdp_data_hard_end(xdp),
which is subject to driver implementation.
A use case of the kfunc is to decapsulate headers residing in xdp
fragments. It is possible for a NIC driver to place headers in xdp
fragments. To keep using direct packet access for parsing and
decapsulating headers, users can pull headers into the linear data
area by calling bpf_xdp_pull_data() and then pop the header with
bpf_xdp_adjust_head().
An unused argument, flags is reserved for future extension (e.g.,
tossing the data instead of copying it to the linear data area).
Signed-off-by: Amery Hung <[email protected]>1 parent 6bb1bc2 commit 3804fea
1 file changed
+76
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12212 | 12212 | | |
12213 | 12213 | | |
12214 | 12214 | | |
| 12215 | + | |
| 12216 | + | |
| 12217 | + | |
| 12218 | + | |
| 12219 | + | |
| 12220 | + | |
| 12221 | + | |
| 12222 | + | |
| 12223 | + | |
| 12224 | + | |
| 12225 | + | |
| 12226 | + | |
| 12227 | + | |
| 12228 | + | |
| 12229 | + | |
| 12230 | + | |
| 12231 | + | |
| 12232 | + | |
| 12233 | + | |
| 12234 | + | |
| 12235 | + | |
| 12236 | + | |
| 12237 | + | |
| 12238 | + | |
| 12239 | + | |
| 12240 | + | |
| 12241 | + | |
| 12242 | + | |
| 12243 | + | |
| 12244 | + | |
| 12245 | + | |
| 12246 | + | |
| 12247 | + | |
| 12248 | + | |
| 12249 | + | |
| 12250 | + | |
| 12251 | + | |
| 12252 | + | |
| 12253 | + | |
| 12254 | + | |
| 12255 | + | |
| 12256 | + | |
| 12257 | + | |
| 12258 | + | |
| 12259 | + | |
| 12260 | + | |
| 12261 | + | |
| 12262 | + | |
| 12263 | + | |
| 12264 | + | |
| 12265 | + | |
| 12266 | + | |
| 12267 | + | |
| 12268 | + | |
| 12269 | + | |
| 12270 | + | |
| 12271 | + | |
| 12272 | + | |
| 12273 | + | |
| 12274 | + | |
| 12275 | + | |
| 12276 | + | |
| 12277 | + | |
| 12278 | + | |
| 12279 | + | |
| 12280 | + | |
| 12281 | + | |
| 12282 | + | |
| 12283 | + | |
| 12284 | + | |
| 12285 | + | |
| 12286 | + | |
| 12287 | + | |
| 12288 | + | |
| 12289 | + | |
12215 | 12290 | | |
12216 | 12291 | | |
12217 | 12292 | | |
| |||
12239 | 12314 | | |
12240 | 12315 | | |
12241 | 12316 | | |
| 12317 | + | |
12242 | 12318 | | |
12243 | 12319 | | |
12244 | 12320 | | |
| |||
0 commit comments