diff options
author | Mina Almasry <almasrymina@google.com> | 2024-08-22 07:51:54 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-08-24 16:27:22 +0200 |
commit | 7d3aed652d090508990d245f9d80dcc481910d02 (patch) | |
tree | 9659be1ae50c1baf88a35bfc492e3abee902d038 /net/core | |
parent | Merge branch 'net-redundant-judgments' (diff) | |
download | linux-7d3aed652d090508990d245f9d80dcc481910d02.tar.xz linux-7d3aed652d090508990d245f9d80dcc481910d02.zip |
net: refactor ->ndo_bpf calls into dev_xdp_propagate
When net devices propagate xdp configurations to slave devices,
we will need to perform a memory provider check to ensure we're
not binding xdp to a device using unreadable netmem.
Currently the ->ndo_bpf calls in a few places. Adding checks to all
these places would not be ideal.
Refactor all the ->ndo_bpf calls into one place where we can add this
check in the future.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Mina Almasry <almasrymina@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d0e7483abdcd..271d6aa0cfb9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9370,6 +9370,15 @@ u8 dev_xdp_prog_count(struct net_device *dev) } EXPORT_SYMBOL_GPL(dev_xdp_prog_count); +int dev_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf) +{ + if (!dev->netdev_ops->ndo_bpf) + return -EOPNOTSUPP; + + return dev->netdev_ops->ndo_bpf(dev, bpf); +} +EXPORT_SYMBOL_GPL(dev_xdp_propagate); + u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode) { struct bpf_prog *prog = dev_xdp_prog(dev, mode); |