mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
bpf: XDP metadata RX kfuncs
Define a new kfunc set (xdp_metadata_kfunc_ids) which implements all possible XDP metatada kfuncs. Not all devices have to implement them. If kfunc is not supported by the target device, the default implementation is called instead. The verifier, at load time, replaces a call to the generic kfunc with a call to the per-device one. Per-device kfunc pointers are stored in separate struct xdp_metadata_ops. Cc: John Fastabend <john.fastabend@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Martin KaFai Lau <martin.lau@linux.dev> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Willem de Bruijn <willemb@google.com> Cc: Jesper Dangaard Brouer <brouer@redhat.com> Cc: Anatoly Burakov <anatoly.burakov@intel.com> Cc: Alexander Lobakin <alexandr.lobakin@intel.com> Cc: Magnus Karlsson <magnus.karlsson@gmail.com> Cc: Maryam Tahhan <mtahhan@redhat.com> Cc: xdp-hints@xdp-project.net Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/r/20230119221536.3349901-8-sdf@google.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
This commit is contained in:
parent
4053570462
commit
3d76a4d3d4
8 changed files with 188 additions and 2 deletions
|
@ -2480,6 +2480,9 @@ bool bpf_offload_dev_match(struct bpf_prog *prog, struct net_device *netdev);
|
|||
void unpriv_ebpf_notify(int new_state);
|
||||
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
|
||||
int bpf_dev_bound_kfunc_check(struct bpf_verifier_log *log,
|
||||
struct bpf_prog_aux *prog_aux);
|
||||
void *bpf_dev_bound_resolve_kfunc(struct bpf_prog *prog, u32 func_id);
|
||||
int bpf_prog_dev_bound_init(struct bpf_prog *prog, union bpf_attr *attr);
|
||||
void bpf_dev_bound_netdev_unregister(struct net_device *dev);
|
||||
|
||||
|
@ -2514,8 +2517,20 @@ void sock_map_unhash(struct sock *sk);
|
|||
void sock_map_destroy(struct sock *sk);
|
||||
void sock_map_close(struct sock *sk, long timeout);
|
||||
#else
|
||||
static inline int bpf_dev_bound_kfunc_check(struct bpf_verifier_log *log,
|
||||
struct bpf_prog_aux *prog_aux)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline void *bpf_dev_bound_resolve_kfunc(struct bpf_prog *prog,
|
||||
u32 func_id)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int bpf_prog_dev_bound_init(struct bpf_prog *prog,
|
||||
union bpf_attr *attr)
|
||||
union bpf_attr *attr)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue