summaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-06-21 18:25:09 -0700
committerDavid S. Miller <davem@davemloft.net>2017-06-23 13:42:20 -0400
commitce158e580a5bdc93286a3b630638bdd47d4ec663 (patch)
tree7273eafe12b38183b57db46abcf7da7dc6139c3c /include/linux/netdevice.h
parentcafa92ac255337517ca2466ab05ca9f24c0ca9de (diff)
downloadop-kernel-dev-ce158e580a5bdc93286a3b630638bdd47d4ec663.zip
op-kernel-dev-ce158e580a5bdc93286a3b630638bdd47d4ec663.tar.gz
xdp: add reporting of offload mode
Extend the XDP_ATTACHED_* values to include offloaded mode. Let drivers report whether program is installed in the driver or the HW by changing the prog_attached field from bool to u8 (type of the netlink attribute). Exploit the fact that the value of XDP_ATTACHED_DRV is 1, therefore since all drivers currently assign the mode with double negation: mode = !!xdp_prog; no drivers have to be modified. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a838591..68f5d89 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -809,7 +809,8 @@ enum xdp_netdev_command {
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,
};
@@ -827,7 +828,7 @@ struct netdev_xdp {
};
/* XDP_QUERY_PROG */
struct {
- bool prog_attached;
+ u8 prog_attached;
u32 prog_id;
};
};
@@ -3307,7 +3308,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
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);
OpenPOWER on IntegriCloud