On Sat, 2016-04-02 at 23:38 -0700, Brenden Blanco wrote: > > Having a common check makes sense. The tricky thing is that the type can > only be checked after taking the reference, and I wanted to keep the > scope of the prog brief in the case of errors. I would have to move the > bpf_prog_get logic into dev_change_bpf_fd and pass a bpf_prog * into the > ndo instead. Would that API look fine to you?
I can't really comment, I wasn't planning on using the API right now :) However, what else is there that the driver could possibly do with the FD, other than getting the bpf_prog? > A possible extension of this is just to keep the bpf_prog * in the > netdev itself and expose a feature flag from the driver rather than > an ndo. But that would mean another 8 bytes in the netdev. That also misses the signal to the driver when the program is set/removed, so I don't think that works. I'd argue it's not really desirable anyway though since I wouldn't expect a majority of drivers to start supporting this. johannes