On 2/21/23 12:39 PM, Jesper Dangaard Brouer wrote:
For me this is more about the API we are giving the BPF-programmer. There can be natural cases why a driver doesn't provide any hardware info for a specific hint. The RX-timestamp is a good practical example, as often only PTP packets will be timestamped by hardware. I can write a BPF-prog that create a stats-map for counting RX-timestamps, expecting to catch any PTP packets with timestamps. The problem is my stats-map cannot record the difference of EOPNOTSUPP vs ENODATA. Thus, the user of my RX-timestamps stats program can draw the wrong conclusion, that there are no packets with (PTP) timestamps, when this was actually a case of driver not implementing this. I hope this simple stats example make is clearer that the BPF-prog can make use of this info runtime. It is simply a question of keeping these cases as separate return codes. Is that too much to ask for from an API?
Instead of reserving an errno for this purpose, it can be decided at load time instead of keep calling a kfunc always returning the same dedicated errno. I still don't hear why xdp-features + bpf global const won't work.