mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
net, core: Add support for XDP redirection to slave device
This adds the ndo_xdp_get_xmit_slave hook for transforming XDP_TX into XDP_REDIRECT after BPF program run when the ingress device is a bond slave. The dev_xdp_prog_count is exposed so that slave devices can be checked for loaded XDP programs in order to avoid the situation where both bond master and slave have programs loaded according to xdp_state. Signed-off-by: Jussi Maki <joamaki@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Jay Vosburgh <j.vosburgh@gmail.com> Cc: Veaceslav Falico <vfalico@gmail.com> Cc: Andy Gospodarek <andy@greyhouse.net> Link: https://lore.kernel.org/bpf/20210731055738.16820-3-joamaki@gmail.com
This commit is contained in:
committed by
Daniel Borkmann
parent
a815bde56b
commit
879af96ffd
@@ -1330,6 +1330,9 @@ struct netdev_net_notifier {
|
||||
* that got dropped are freed/returned via xdp_return_frame().
|
||||
* Returns negative number, means general error invoking ndo, meaning
|
||||
* no frames were xmit'ed and core-caller will free all frames.
|
||||
* struct net_device *(*ndo_xdp_get_xmit_slave)(struct net_device *dev,
|
||||
* struct xdp_buff *xdp);
|
||||
* Get the xmit slave of master device based on the xdp_buff.
|
||||
* int (*ndo_xsk_wakeup)(struct net_device *dev, u32 queue_id, u32 flags);
|
||||
* This function is used to wake up the softirq, ksoftirqd or kthread
|
||||
* responsible for sending and/or receiving packets on a specific
|
||||
@@ -1557,6 +1560,8 @@ struct net_device_ops {
|
||||
int (*ndo_xdp_xmit)(struct net_device *dev, int n,
|
||||
struct xdp_frame **xdp,
|
||||
u32 flags);
|
||||
struct net_device * (*ndo_xdp_get_xmit_slave)(struct net_device *dev,
|
||||
struct xdp_buff *xdp);
|
||||
int (*ndo_xsk_wakeup)(struct net_device *dev,
|
||||
u32 queue_id, u32 flags);
|
||||
struct devlink_port * (*ndo_get_devlink_port)(struct net_device *dev);
|
||||
@@ -4087,6 +4092,7 @@ typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf);
|
||||
int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
|
||||
int fd, int expected_fd, u32 flags);
|
||||
int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
|
||||
u8 dev_xdp_prog_count(struct net_device *dev);
|
||||
u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode);
|
||||
|
||||
int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
|
||||
|
||||
Reference in New Issue
Block a user