Commit 5f05e25
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 data area when there
is enough room. Specifically, the kfunc will try to use the tailroom
first. When the tailroom is not enough, metadata and data will be
shifted down to make room for pulling data.
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().
Reviewed-by: Jakub Kicinski <[email protected]>
Signed-off-by: Amery Hung <[email protected]>1 parent 8d8a2e2 commit 5f05e25
1 file changed
+91
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12216 | 12216 | | |
12217 | 12217 | | |
12218 | 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 | + | |
| 12290 | + | |
| 12291 | + | |
| 12292 | + | |
| 12293 | + | |
| 12294 | + | |
| 12295 | + | |
| 12296 | + | |
| 12297 | + | |
| 12298 | + | |
| 12299 | + | |
| 12300 | + | |
| 12301 | + | |
| 12302 | + | |
| 12303 | + | |
| 12304 | + | |
| 12305 | + | |
| 12306 | + | |
| 12307 | + | |
| 12308 | + | |
12219 | 12309 | | |
12220 | 12310 | | |
12221 | 12311 | | |
| |||
12243 | 12333 | | |
12244 | 12334 | | |
12245 | 12335 | | |
| 12336 | + | |
12246 | 12337 | | |
12247 | 12338 | | |
12248 | 12339 | | |
| |||
0 commit comments