xdp: don't make drivers report attachment mode
prog_attached of struct netdev_bpf should have been superseded by simply setting prog_id long time ago, but we kept it around to allow offloading drivers to communicate attachment mode (drv vs hw). Subsequently drivers were also allowed to report back attachment flags (prog_flags), and since nowadays only programs attached will XDP_FLAGS_HW_MODE can get offloaded, we can tell the attachment mode from the flags driver reports. Remove prog_attached member. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:

committed by
Daniel Borkmann

parent
4f91da26c8
commit
6b86758973
@@ -4926,7 +4926,6 @@ static int generic_xdp_install(struct net_device *dev, struct netdev_bpf *xdp)
|
||||
break;
|
||||
|
||||
case XDP_QUERY_PROG:
|
||||
xdp->prog_attached = !!old;
|
||||
xdp->prog_id = old ? old->aux->id : 0;
|
||||
break;
|
||||
|
||||
@@ -7593,13 +7592,13 @@ void __dev_xdp_query(struct net_device *dev, bpf_op_t bpf_op,
|
||||
WARN_ON(bpf_op(dev, xdp) < 0);
|
||||
}
|
||||
|
||||
static u8 __dev_xdp_attached(struct net_device *dev, bpf_op_t bpf_op)
|
||||
static bool __dev_xdp_attached(struct net_device *dev, bpf_op_t bpf_op)
|
||||
{
|
||||
struct netdev_bpf xdp;
|
||||
|
||||
__dev_xdp_query(dev, bpf_op, &xdp);
|
||||
|
||||
return xdp.prog_attached;
|
||||
return xdp.prog_id;
|
||||
}
|
||||
|
||||
static int dev_xdp_install(struct net_device *dev, bpf_op_t bpf_op,
|
||||
@@ -7634,7 +7633,7 @@ static void dev_xdp_uninstall(struct net_device *dev)
|
||||
return;
|
||||
|
||||
__dev_xdp_query(dev, ndo_bpf, &xdp);
|
||||
if (xdp.prog_attached == XDP_ATTACHED_NONE)
|
||||
if (!xdp.prog_id)
|
||||
return;
|
||||
|
||||
/* Program removal should always succeed */
|
||||
|
Reference in New Issue
Block a user