On Tue, Jan 16, 2018 at 04:05:19PM -0800, Jakub Kicinski wrote:
> From: Jiong Wang <jiong.w...@netronome.com>
> 
> For host JIT, there are "jited_len"/"bpf_func" fields in struct bpf_prog
> used by all host JIT targets to get jited image and it's length. While for
> offload, targets are likely to have different offload mechanisms that these
> info are kept in device private data fields.
> 
> Therefore, BPF_OBJ_GET_INFO_BY_FD syscall needs an unified way to get JIT
> length and contents info for offload targets.
> 
> One way is to introduce new callback to parse device private data then fill
> those fields in bpf_prog_info. This might be a little heavy, the other way
> is to add generic fields which will be initialized by all offload targets.
> 
> This patch follow the second approach to introduce two new fields in
> struct bpf_dev_offload and teach bpf_prog_get_info_by_fd about them to fill
> correct jited_prog_len and jited_prog_insns in bpf_prog_info.
> 
> Reviewed-by: Jakub Kicinski <jakub.kicin...@netronome.com>
> Signed-off-by: Jiong Wang <jiong.w...@netronome.com>

Acked-by: Alexei Starovoitov <a...@kernel.org>

initially I wasn't sure that reusing jited_prog_insns field
to return offloaded prog is such a good idea, but since we
fill in ifindex at the same time the usage of the field is not ambiguous,
so I think it's a good approach.

Reply via email to