Differ between illegal XDP action code and just driver unsupported one to provide better feedback when we throw a one-time warning here. Reason is that with 814abfabef3c ("xdp: add bpf_redirect helper function") not all drivers support the new XDP return code yet and thus they will fall into their 'default' case when checking for return codes after program return, which then triggers a bpf_warn_invalid_xdp_action() stating that the return code is illegal, but from XDP perspective it's not. I decided not to place something like a XDP_ACT_MAX define into uapi i) given we don't have this either for all other program types, ii) future action codes could have further encoding there, which would render such define unsuitable and we wouldn't be able to rip it out again, and iii) we rarely add new action codes.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -766,8 +766,8 @@ struct bpf_sock { · 765 unmodified lines | |||
| 766 | 766 | ||
| 767 | /* User return codes for XDP prog type. | 767 | /* User return codes for XDP prog type. |
| 768 | * A valid XDP program must return one of these defined values. All other | 768 | * A valid XDP program must return one of these defined values. All other |
| 769 | * return codes are reserved for future use. Unknown return codes will result | 769 | * return codes are reserved for future use. Unknown return codes will |
| 770 | * in packet drop. | 770 | * result in packet drops and a warning via bpf_warn_invalid_xdp_action(). |
| 771 | */ | 771 | */ |
| 772 | enum xdp_action { | 772 | enum xdp_action { |
| 773 | XDP_ABORTED = 0, | 773 | XDP_ABORTED = 0, |