mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 13:23:23 +01:00
bpf: Move offload initialization into late_initcall
So we don't have to initialize it manually from several paths. Cc: John Fastabend <[email protected]> Cc: David Ahern <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Willem de Bruijn <[email protected]> Cc: Jesper Dangaard Brouer <[email protected]> Cc: Anatoly Burakov <[email protected]> Cc: Alexander Lobakin <[email protected]> Cc: Magnus Karlsson <[email protected]> Cc: Maryam Tahhan <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
This commit is contained in:
1 parent
9d03ebc71a
commit
f1fc43d039
1 file changed
+7
-15
+7
-15
@@ -56,7 +56,6 @@ static const struct rhashtable_params offdevs_params = {
|
||||
};
|
||||
|
||||
static struct rhashtable offdevs;
|
||||
static bool offdevs_inited;
|
||||
|
||||
static int bpf_dev_offload_check(struct net_device *netdev)
|
||||
{
|
||||
@@ -72,8 +71,6 @@ bpf_offload_find_netdev(struct net_device *netdev)
|
||||
{
|
||||
lockdep_assert_held(&bpf_devs_lock);
|
||||
|
||||
if (!offdevs_inited)
|
||||
return NULL;
|
||||
return rhashtable_lookup_fast(&offdevs, &netdev, offdevs_params);
|
||||
}
|
||||
|
||||
@@ -673,18 +670,6 @@ struct bpf_offload_dev *
|
||||
bpf_offload_dev_create(const struct bpf_prog_offload_ops *ops, void *priv)
|
||||
{
|
||||
struct bpf_offload_dev *offdev;
|
||||
int err;
|
||||
|
||||
down_write(&bpf_devs_lock);
|
||||
if (!offdevs_inited) {
|
||||
err = rhashtable_init(&offdevs, &offdevs_params);
|
||||
if (err) {
|
||||
up_write(&bpf_devs_lock);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
offdevs_inited = true;
|
||||
}
|
||||
up_write(&bpf_devs_lock);
|
||||
|
||||
offdev = kzalloc(sizeof(*offdev), GFP_KERNEL);
|
||||
if (!offdev)
|
||||
@@ -710,3 +695,10 @@ void *bpf_offload_dev_priv(struct bpf_offload_dev *offdev)
|
||||
return offdev->priv;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bpf_offload_dev_priv);
|
||||
|
||||
static int __init bpf_offload_init(void)
|
||||
{
|
||||
return rhashtable_init(&offdevs, &offdevs_params);
|
||||
}
|
||||
|
||||
late_initcall(bpf_offload_init);
|
||||
Reference in new issue
Block a user