linux/net/core/netprio_cgroup.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * net/core/netprio_cgroup.c	Priority Control Group
 *
 * Authors:	Neil Horman <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/skbuff.h>
#include <linux/cgroup.h>
#include <linux/rcupdate.h>
#include <linux/atomic.h>
#include <linux/sched/task.h>

#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
#include <net/sock.h>
#include <net/netprio_cgroup.h>

#include <linux/fdtable.h>

/*
 * netprio allocates per-net_device priomap array which is indexed by
 * css->id.  Limiting css ID to 16bits doesn't lose anything.
 */
#define NETPRIO_ID_MAX

#define PRIOMAP_MIN_SZ

/*
 * Extend @dev->priomap so that it's large enough to accommodate
 * @target_idx.  @dev->priomap.priomap_len > @target_idx after successful
 * return.  Must be called under rtnl lock.
 */
static int extend_netdev_table(struct net_device *dev, u32 target_idx)
{}

/**
 * netprio_prio - return the effective netprio of a cgroup-net_device pair
 * @css: css part of the target pair
 * @dev: net_device part of the target pair
 *
 * Should be called under RCU read or rtnl lock.
 */
static u32 netprio_prio(struct cgroup_subsys_state *css, struct net_device *dev)
{}

/**
 * netprio_set_prio - set netprio on a cgroup-net_device pair
 * @css: css part of the target pair
 * @dev: net_device part of the target pair
 * @prio: prio to set
 *
 * Set netprio to @prio on @css-@dev pair.  Should be called under rtnl
 * lock and may fail under memory pressure for non-zero @prio.
 */
static int netprio_set_prio(struct cgroup_subsys_state *css,
			    struct net_device *dev, u32 prio)
{}

static struct cgroup_subsys_state *
cgrp_css_alloc(struct cgroup_subsys_state *parent_css)
{}

static int cgrp_css_online(struct cgroup_subsys_state *css)
{}

static void cgrp_css_free(struct cgroup_subsys_state *css)
{}

static u64 read_prioidx(struct cgroup_subsys_state *css, struct cftype *cft)
{}

static int read_priomap(struct seq_file *sf, void *v)
{}

static ssize_t write_priomap(struct kernfs_open_file *of,
			     char *buf, size_t nbytes, loff_t off)
{}

static int update_netprio(const void *v, struct file *file, unsigned n)
{}

static void net_prio_attach(struct cgroup_taskset *tset)
{}

static struct cftype ss_files[] =;

struct cgroup_subsys net_prio_cgrp_subsys =;

static int netprio_device_event(struct notifier_block *unused,
				unsigned long event, void *ptr)
{}

static struct notifier_block netprio_device_notifier =;

static int __init init_cgroup_netprio(void)
{}
subsys_initcall(init_cgroup_netprio);