net: sched: cls_bpf: implement offload tcf_proto_op
authorJohn Hurley <john.hurley@netronome.com>
Mon, 25 Jun 2018 21:30:09 +0000 (14:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Jun 2018 14:21:33 +0000 (23:21 +0900)
commit7e916b76805f11c1686a43ab5ead9a9b1a0a5945
tree546e10b17f4ec1c035b0c00fa288b9b86ad20954
parent530d995123fe647d28566d81ff9562fe6cbaff94
net: sched: cls_bpf: implement offload tcf_proto_op

Add the offload tcf_proto_op in cls_bpf to generate an offload message for
each bpf prog in the given tcf_proto. Call the specified callback with
this new offload message. The function only returns an error if the
callback rejects adding a 'hardware only' prog.

A prog contains a flag to indicate if it is in hardware or not. To
ensure the offload function properly maintains this flag, keep a reference
counter for the number of instances of the prog that are in hardware. Only
update the flag when this counter changes from or to 0.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_bpf.c