Commit 704cf34
mptcp: reuse sending nlmsg code in dump_addr
A new type mptcp_pm_addr_id_bitmap_t is defined to easily modify
dump_addr() interface of the path managers to accept an id_bitmap
type parameter. It also allows this parameter of dump_addr() can
be modified by BPF program when implementing this interface of a
BFP path manager.
With the help of get_addr(), we can modify dump_addr() interfaces
to reuse send_nlmsg code between the netlink PM and userspace PM.
The current dump_addr() flow looks like this:
lock();
for_each_entry(entry)
send_nlmsg(entry);
unlock();
After holding the lock, get every entry by walking the address list,
send each one looply, and finally release the lock.
This set changes the process by copying the address list to an id
bitmap while holding the lock, then release the lock immediately.
After that, without locking, walking the copied id bitmap to get
every copy of entry by using get_addr(), and send each one looply:
lock();
for_each_entry(entry)
set_bit(bitmap);
unlock();
for_each_bit(bitmap) {
copy = get_addr();
send_nlmsg(copy);
}
With this, we can reuse the send_nlmsg() code in dump_addr() interfaces
between the netlink PM and userspace PM. They only need to implement
their own dump_addr() interfaces to hold the different locks, copy the
different address lists to an id bitmap, then release the locks.
Signed-off-by: Geliang Tang <[email protected]>1 parent 38d7bb6 commit 704cf34
File tree
5 files changed
+65
-71
lines changed- include/net
- net/mptcp
5 files changed
+65
-71
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
488 | | - | |
| 488 | + | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
492 | | - | |
493 | | - | |
| 492 | + | |
| 493 | + | |
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
500 | 505 | | |
501 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
502 | 536 | | |
503 | 537 | | |
504 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1783 | 1783 | | |
1784 | 1784 | | |
1785 | 1785 | | |
1786 | | - | |
1787 | | - | |
| 1786 | + | |
1788 | 1787 | | |
1789 | 1788 | | |
1790 | 1789 | | |
1791 | | - | |
1792 | 1790 | | |
1793 | | - | |
1794 | | - | |
1795 | | - | |
1796 | 1791 | | |
1797 | 1792 | | |
1798 | 1793 | | |
1799 | 1794 | | |
1800 | | - | |
1801 | | - | |
1802 | | - | |
1803 | | - | |
1804 | | - | |
1805 | | - | |
1806 | | - | |
1807 | | - | |
1808 | | - | |
1809 | | - | |
1810 | | - | |
1811 | | - | |
1812 | | - | |
1813 | | - | |
1814 | | - | |
1815 | | - | |
1816 | | - | |
1817 | | - | |
1818 | | - | |
1819 | | - | |
1820 | | - | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
| 1795 | + | |
1824 | 1796 | | |
1825 | 1797 | | |
1826 | | - | |
1827 | | - | |
| 1798 | + | |
1828 | 1799 | | |
1829 | 1800 | | |
1830 | 1801 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | | - | |
618 | | - | |
619 | | - | |
| 617 | + | |
| 618 | + | |
620 | 619 | | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
625 | 633 | | |
626 | 634 | | |
627 | 635 | | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | 636 | | |
632 | 637 | | |
633 | 638 | | |
| |||
637 | 642 | | |
638 | 643 | | |
639 | 644 | | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
| 645 | + | |
658 | 646 | | |
659 | 647 | | |
660 | | - | |
661 | 648 | | |
662 | 649 | | |
663 | 650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | 211 | | |
215 | 212 | | |
216 | 213 | | |
| |||
1127 | 1124 | | |
1128 | 1125 | | |
1129 | 1126 | | |
1130 | | - | |
1131 | | - | |
| 1127 | + | |
1132 | 1128 | | |
1133 | | - | |
1134 | | - | |
| 1129 | + | |
1135 | 1130 | | |
1136 | 1131 | | |
1137 | 1132 | | |
| |||
0 commit comments