Skip to content

Commit 92f0292

Browse files
Jakub Kicinskiborkmann
authored andcommitted
net: xdp: report flags program was installed with on query
Some drivers enforce that flags on program replacement and removal must match the flags passed on install. This leaves the possibility open to enable simultaneous loading of XDP programs both to HW and DRV. Allow such drivers to report the flags back to the stack. Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Quentin Monnet <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 118b4aa commit 92f0292

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,6 +3392,7 @@ static int nfp_net_xdp(struct net_device *netdev, struct netdev_bpf *xdp)
33923392
if (nn->dp.bpf_offload_xdp)
33933393
xdp->prog_attached = XDP_ATTACHED_HW;
33943394
xdp->prog_id = nn->xdp_prog ? nn->xdp_prog->aux->id : 0;
3395+
xdp->flags = nn->xdp_prog ? nn->xdp_flags : 0;
33953396
return 0;
33963397
case BPF_OFFLOAD_VERIFIER_PREP:
33973398
return nfp_app_bpf_verifier_prep(nn->app, nn, xdp);

include/linux/netdevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,8 @@ struct netdev_bpf {
820820
struct {
821821
u8 prog_attached;
822822
u32 prog_id;
823+
/* flags with which program was installed */
824+
u32 prog_flags;
823825
};
824826
/* BPF_OFFLOAD_VERIFIER_PREP */
825827
struct {

0 commit comments

Comments
 (0)