Commit 7f0a838
bpf, xdp: Maintain info on attached XDP BPF programs in net_device
Instead of delegating to drivers, maintain information about which BPF
programs are attached in which XDP modes (generic/skb, driver, or hardware)
locally in net_device. This effectively obsoletes XDP_QUERY_PROG command.
Such re-organization simplifies existing code already. But it also allows to
further add bpf_link-based XDP attachments without drivers having to know
about any of this at all, which seems like a good setup.
XDP_SETUP_PROG/XDP_SETUP_PROG_HW are just low-level commands to driver to
install/uninstall active BPF program. All the higher-level concerns about
prog/link interaction will be contained within generic driver-agnostic logic.
All the XDP_QUERY_PROG calls to driver in dev_xdp_uninstall() were removed.
It's not clear for me why dev_xdp_uninstall() were passing previous prog_flags
when resetting installed programs. That seems unnecessary, plus most drivers
don't populate prog_flags anyways. Having XDP_SETUP_PROG vs XDP_SETUP_PROG_HW
should be enough of an indicator of what is required of driver to correctly
reset active BPF program. dev_xdp_uninstall() is also generalized as an
iteration over all three supported mode.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200722064603.3350758-3-andriin@fb.com1 parent 6cc7d1e commit 7f0a838
3 files changed
+105
-75
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
892 | 903 | | |
893 | 904 | | |
894 | 905 | | |
| |||
2142 | 2153 | | |
2143 | 2154 | | |
2144 | 2155 | | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
2145 | 2159 | | |
2146 | 2160 | | |
2147 | 2161 | | |
| |||
3817 | 3831 | | |
3818 | 3832 | | |
3819 | 3833 | | |
3820 | | - | |
3821 | | - | |
| 3834 | + | |
3822 | 3835 | | |
3823 | 3836 | | |
3824 | 3837 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8716 | 8716 | | |
8717 | 8717 | | |
8718 | 8718 | | |
8719 | | - | |
8720 | | - | |
| 8719 | + | |
8721 | 8720 | | |
8722 | | - | |
| 8721 | + | |
| 8722 | + | |
| 8723 | + | |
| 8724 | + | |
| 8725 | + | |
| 8726 | + | |
8723 | 8727 | | |
8724 | | - | |
8725 | | - | |
| 8728 | + | |
| 8729 | + | |
| 8730 | + | |
| 8731 | + | |
| 8732 | + | |
| 8733 | + | |
| 8734 | + | |
| 8735 | + | |
| 8736 | + | |
| 8737 | + | |
| 8738 | + | |
| 8739 | + | |
8726 | 8740 | | |
8727 | | - | |
8728 | | - | |
| 8741 | + | |
| 8742 | + | |
| 8743 | + | |
| 8744 | + | |
| 8745 | + | |
| 8746 | + | |
| 8747 | + | |
| 8748 | + | |
| 8749 | + | |
8729 | 8750 | | |
8730 | | - | |
8731 | | - | |
| 8751 | + | |
| 8752 | + | |
8732 | 8753 | | |
8733 | | - | |
| 8754 | + | |
| 8755 | + | |
| 8756 | + | |
| 8757 | + | |
8734 | 8758 | | |
8735 | 8759 | | |
8736 | | - | |
8737 | | - | |
8738 | | - | |
| 8760 | + | |
| 8761 | + | |
| 8762 | + | |
8739 | 8763 | | |
8740 | | - | |
8741 | | - | |
8742 | 8764 | | |
8743 | 8765 | | |
8744 | 8766 | | |
8745 | | - | |
8746 | | - | |
8747 | | - | |
8748 | | - | |
8749 | | - | |
8750 | | - | |
8751 | | - | |
8752 | 8767 | | |
8753 | | - | |
8754 | | - | |
8755 | | - | |
8756 | | - | |
| 8768 | + | |
8757 | 8769 | | |
8758 | 8770 | | |
8759 | 8771 | | |
8760 | 8772 | | |
| 8773 | + | |
| 8774 | + | |
| 8775 | + | |
| 8776 | + | |
| 8777 | + | |
| 8778 | + | |
| 8779 | + | |
| 8780 | + | |
8761 | 8781 | | |
8762 | | - | |
8763 | | - | |
| 8782 | + | |
| 8783 | + | |
| 8784 | + | |
| 8785 | + | |
| 8786 | + | |
8764 | 8787 | | |
8765 | | - | |
8766 | | - | |
| 8788 | + | |
| 8789 | + | |
8767 | 8790 | | |
8768 | | - | |
| 8791 | + | |
8769 | 8792 | | |
8770 | 8793 | | |
8771 | 8794 | | |
8772 | 8795 | | |
8773 | | - | |
8774 | | - | |
| 8796 | + | |
| 8797 | + | |
| 8798 | + | |
8775 | 8799 | | |
8776 | | - | |
8777 | | - | |
| 8800 | + | |
8778 | 8801 | | |
8779 | | - | |
8780 | | - | |
8781 | | - | |
8782 | | - | |
| 8802 | + | |
| 8803 | + | |
| 8804 | + | |
| 8805 | + | |
8783 | 8806 | | |
8784 | | - | |
8785 | | - | |
8786 | | - | |
8787 | | - | |
8788 | | - | |
8789 | | - | |
| 8807 | + | |
| 8808 | + | |
| 8809 | + | |
8790 | 8810 | | |
8791 | | - | |
8792 | | - | |
8793 | | - | |
8794 | | - | |
8795 | | - | |
8796 | | - | |
| 8811 | + | |
| 8812 | + | |
| 8813 | + | |
| 8814 | + | |
| 8815 | + | |
8797 | 8816 | | |
8798 | 8817 | | |
8799 | 8818 | | |
| |||
8810 | 8829 | | |
8811 | 8830 | | |
8812 | 8831 | | |
8813 | | - | |
| 8832 | + | |
| 8833 | + | |
8814 | 8834 | | |
8815 | | - | |
8816 | 8835 | | |
8817 | | - | |
| 8836 | + | |
8818 | 8837 | | |
8819 | 8838 | | |
8820 | 8839 | | |
8821 | 8840 | | |
8822 | | - | |
8823 | | - | |
8824 | | - | |
8825 | | - | |
8826 | | - | |
| 8841 | + | |
| 8842 | + | |
8827 | 8843 | | |
8828 | 8844 | | |
8829 | 8845 | | |
8830 | | - | |
8831 | | - | |
8832 | | - | |
8833 | | - | |
8834 | 8846 | | |
8835 | | - | |
| 8847 | + | |
8836 | 8848 | | |
8837 | 8849 | | |
8838 | 8850 | | |
| |||
8850 | 8862 | | |
8851 | 8863 | | |
8852 | 8864 | | |
8853 | | - | |
8854 | | - | |
| 8865 | + | |
| 8866 | + | |
| 8867 | + | |
| 8868 | + | |
| 8869 | + | |
8855 | 8870 | | |
8856 | 8871 | | |
8857 | 8872 | | |
| |||
8866 | 8881 | | |
8867 | 8882 | | |
8868 | 8883 | | |
8869 | | - | |
| 8884 | + | |
8870 | 8885 | | |
8871 | 8886 | | |
8872 | 8887 | | |
| |||
8895 | 8910 | | |
8896 | 8911 | | |
8897 | 8912 | | |
8898 | | - | |
8899 | | - | |
| 8913 | + | |
| 8914 | + | |
8900 | 8915 | | |
| 8916 | + | |
| 8917 | + | |
| 8918 | + | |
8901 | 8919 | | |
8902 | | - | |
| 8920 | + | |
8903 | 8921 | | |
8904 | 8922 | | |
8905 | 8923 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1416 | 1416 | | |
1417 | 1417 | | |
1418 | 1418 | | |
1419 | | - | |
| 1419 | + | |
1420 | 1420 | | |
1421 | 1421 | | |
1422 | 1422 | | |
1423 | 1423 | | |
1424 | | - | |
1425 | | - | |
| 1424 | + | |
1426 | 1425 | | |
1427 | 1426 | | |
1428 | 1427 | | |
| |||
0 commit comments