Commit fd448bb
bpf: run devmap xdp_prog on flush instead of bulk enqueue
This changes the devmap XDP program support to run the program when the
bulk queue is flushed instead of before the frame is enqueued. This has
a couple of benefits:
- It "sorts" the packets by destination devmap entry, and then runs the
same BPF program on all the packets in sequence. This ensures that we
keep the XDP program and destination device properties hot in I-cache.
- It makes the multicast implementation simpler because it can just
enqueue packets using bq_enqueue() without having to deal with the
devmap program at all.
The drawback is that if the devmap program drops the packet, the enqueue
step is redundant. However, arguably this is mostly visible in a
micro-benchmark, and with more mixed traffic the I-cache benefit should
win out. The performance impact of just this patch is as follows:
The bq_xmit_all's logic is also refactored and error label is removed.
When bq_xmit_all() is called from bq_enqueue(), another packet will
always be enqueued immediately after, so clearing dev_rx, xdp_prog and
flush_node in bq_xmit_all() is redundant. Let's move the clear to
__dev_flush(), and only check them once in bq_enqueue() since they are
all modified together.
By using xdp_redirect_map in sample/bpf and send pkts via pktgen cmd:
./pktgen_sample03_burst_single_flow.sh -i eno1 -d $dst_ip -m $dst_mac -t 10 -s 64
There are about +/- 0.1M deviation for native testing, the performance
improved for the base-case, but some drop back with xdp devmap prog attached.
Version | Test | Generic | Native | Native + 2nd xdp_prog
5.10 rc6 | xdp_redirect_map i40e->i40e | 2.0M | 9.1M | 8.0M
5.10 rc6 | xdp_redirect_map i40e->veth | 1.7M | 11.0M | 9.7M
5.10 rc6 + patch | xdp_redirect_map i40e->i40e | 2.0M | 9.5M | 7.5M
5.10 rc6 + patch | xdp_redirect_map i40e->veth | 1.7M | 11.6M | 9.1M
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>1 parent bb21fad commit fd448bb
1 file changed
+84
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
327 | 328 | | |
328 | 329 | | |
329 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
330 | 370 | | |
331 | 371 | | |
332 | 372 | | |
333 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
334 | 377 | | |
335 | 378 | | |
336 | | - | |
| 379 | + | |
337 | 380 | | |
338 | 381 | | |
339 | | - | |
| 382 | + | |
340 | 383 | | |
341 | 384 | | |
342 | 385 | | |
343 | 386 | | |
344 | 387 | | |
345 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
346 | 398 | | |
347 | 399 | | |
348 | 400 | | |
349 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
350 | 410 | | |
351 | | - | |
352 | 411 | | |
| 412 | + | |
353 | 413 | | |
354 | 414 | | |
355 | 415 | | |
356 | | - | |
357 | | - | |
358 | 416 | | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | 417 | | |
371 | 418 | | |
372 | 419 | | |
| |||
384 | 431 | | |
385 | 432 | | |
386 | 433 | | |
387 | | - | |
| 434 | + | |
388 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
389 | 440 | | |
390 | 441 | | |
391 | 442 | | |
| |||
408 | 459 | | |
409 | 460 | | |
410 | 461 | | |
411 | | - | |
| 462 | + | |
412 | 463 | | |
413 | 464 | | |
414 | 465 | | |
| |||
419 | 470 | | |
420 | 471 | | |
421 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
422 | 476 | | |
423 | | - | |
| 477 | + | |
424 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
425 | 482 | | |
426 | 483 | | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | 484 | | |
431 | 485 | | |
432 | 486 | | |
433 | | - | |
| 487 | + | |
| 488 | + | |
434 | 489 | | |
435 | 490 | | |
436 | 491 | | |
| |||
446 | 501 | | |
447 | 502 | | |
448 | 503 | | |
449 | | - | |
| 504 | + | |
450 | 505 | | |
451 | 506 | | |
452 | 507 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | 508 | | |
482 | 509 | | |
483 | 510 | | |
484 | | - | |
| 511 | + | |
485 | 512 | | |
486 | 513 | | |
487 | 514 | | |
488 | 515 | | |
489 | 516 | | |
490 | 517 | | |
491 | 518 | | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 519 | + | |
498 | 520 | | |
499 | 521 | | |
500 | 522 | | |
| |||
0 commit comments