XDP_SETUP_PROG,
XDP_SETUP_PROG_HW,
/* Check if a bpf program is set on the device. The callee should
- * return true if a program is currently attached and running.
+ * set @prog_attached to one of XDP_ATTACHED_* values, note that "true"
+ * is equivalent to XDP_ATTACHED_DRV.
*/
XDP_QUERY_PROG,
};
};
/* XDP_QUERY_PROG */
struct {
- bool prog_attached;
+ u8 prog_attached;
u32 prog_id;
};
};
typedef int (*xdp_op_t)(struct net_device *dev, struct netdev_xdp *xdp);
int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
int fd, u32 flags);
-bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op, u32 *prog_id);
+u8 __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op, u32 *prog_id);
int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
}
EXPORT_SYMBOL(dev_change_proto_down);
-bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op,
- u32 *prog_id)
+u8 __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op, u32 *prog_id)
{
struct netdev_xdp xdp;
*prog_id = generic_xdp_prog->aux->id;
return XDP_ATTACHED_SKB;
}
- if (ops->ndo_xdp && __dev_xdp_attached(dev, ops->ndo_xdp, prog_id))
- return XDP_ATTACHED_DRV;
+ if (!ops->ndo_xdp)
+ return XDP_ATTACHED_NONE;
- return XDP_ATTACHED_NONE;
+ return __dev_xdp_attached(dev, ops->ndo_xdp, prog_id);
}
static int rtnl_xdp_fill(struct sk_buff *skb, struct net_device *dev)