linux/net/devlink/core.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
 * Copyright (c) 2016 Jiri Pirko <[email protected]>
 */

#include <net/genetlink.h>
#define CREATE_TRACE_POINTS
#include <trace/events/devlink.h>

#include "devl_internal.h"

EXPORT_TRACEPOINT_SYMBOL_GPL();
EXPORT_TRACEPOINT_SYMBOL_GPL();
EXPORT_TRACEPOINT_SYMBOL_GPL();

DEFINE_XARRAY_FLAGS();

static struct devlink *devlinks_xa_get(unsigned long index)
{}

/* devlink_rels xarray contains 1:1 relationships between
 * devlink object and related nested devlink instance.
 * The xarray index is used to get the nested object from
 * the nested-in object code.
 */
static DEFINE_XARRAY_FLAGS(devlink_rels, XA_FLAGS_ALLOC1);

#define DEVLINK_REL_IN_USE

struct devlink_rel {};

static void devlink_rel_free(struct devlink_rel *rel)
{}

static void __devlink_rel_get(struct devlink_rel *rel)
{}

static void __devlink_rel_put(struct devlink_rel *rel)
{}

static void devlink_rel_nested_in_notify_work(struct work_struct *work)
{}

static void devlink_rel_nested_in_notify_work_schedule(struct devlink_rel *rel)
{}

static struct devlink_rel *devlink_rel_alloc(void)
{}

static void devlink_rel_put(struct devlink *devlink)
{}

void devlink_rel_nested_in_clear(u32 rel_index)
{}

int devlink_rel_nested_in_add(u32 *rel_index, u32 devlink_index,
			      u32 obj_index, devlink_rel_notify_cb_t *notify_cb,
			      devlink_rel_cleanup_cb_t *cleanup_cb,
			      struct devlink *devlink)
{}

/**
 * devlink_rel_nested_in_notify - Notify the object this devlink
 *				  instance is nested in.
 * @devlink: devlink
 *
 * This is called upon network namespace change of devlink instance.
 * In case this devlink instance is nested in another devlink object,
 * a notification of a change of this object should be sent
 * over netlink. The parent devlink instance lock needs to be
 * taken during the notification preparation.
 * However, since the devlink lock of nested instance is held here,
 * we would end with wrong devlink instance lock ordering and
 * deadlock. Therefore the work is utilized to avoid that.
 */
void devlink_rel_nested_in_notify(struct devlink *devlink)
{}

static struct devlink_rel *devlink_rel_find(unsigned long rel_index)
{}

static struct devlink *devlink_rel_devlink_get(u32 rel_index)
{}

int devlink_rel_devlink_handle_put(struct sk_buff *msg, struct devlink *devlink,
				   u32 rel_index, int attrtype,
				   bool *msg_updated)
{}

void *devlink_priv(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

struct devlink *priv_to_devlink(void *priv)
{}
EXPORT_SYMBOL_GPL();

struct device *devlink_to_dev(const struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

struct net *devlink_net(const struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

void devl_assert_locked(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_LOCKDEP
/* For use in conjunction with LOCKDEP only e.g. rcu_dereference_protected() */
bool devl_lock_is_held(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();
#endif

void devl_lock(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

int devl_trylock(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

void devl_unlock(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

/**
 * devlink_try_get() - try to obtain a reference on a devlink instance
 * @devlink: instance to reference
 *
 * Obtain a reference on a devlink instance. A reference on a devlink instance
 * only implies that it's safe to take the instance lock. It does not imply
 * that the instance is registered, use devl_is_registered() after taking
 * the instance lock to check registration status.
 */
struct devlink *__must_check devlink_try_get(struct devlink *devlink)
{}

static void devlink_release(struct work_struct *work)
{}

void devlink_put(struct devlink *devlink)
{}

struct devlink *devlinks_xa_find_get(struct net *net, unsigned long *indexp)
{}

/**
 * devl_register - Register devlink instance
 * @devlink: devlink
 */
int devl_register(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

void devlink_register(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

/**
 * devl_unregister - Unregister devlink instance
 * @devlink: devlink
 */
void devl_unregister(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

void devlink_unregister(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

/**
 *	devlink_alloc_ns - Allocate new devlink instance resources
 *	in specific namespace
 *
 *	@ops: ops
 *	@priv_size: size of user private data
 *	@net: net namespace
 *	@dev: parent device
 *
 *	Allocate new devlink instance resources, including devlink index
 *	and name.
 */
struct devlink *devlink_alloc_ns(const struct devlink_ops *ops,
				 size_t priv_size, struct net *net,
				 struct device *dev)
{}
EXPORT_SYMBOL_GPL();

/**
 *	devlink_free - Free devlink instance resources
 *
 *	@devlink: devlink
 */
void devlink_free(struct devlink *devlink)
{}
EXPORT_SYMBOL_GPL();

static void __net_exit devlink_pernet_pre_exit(struct net *net)
{}

static struct pernet_operations devlink_pernet_ops __net_initdata =;

static struct notifier_block devlink_port_netdevice_nb =;

static int __init devlink_init(void)
{}

subsys_initcall(devlink_init);