Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20fea08b authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

[NET]: Move Qdisc_class_ops and Qdisc_ops in appropriate sections.



Qdisc_class_ops are const, and Qdisc_ops are mostly read.

Using "const" and "__read_mostly" qualifiers helps to reduce false
sharing.

Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2a8cc6c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -86,7 +86,7 @@ struct Qdisc_class_ops
struct Qdisc_ops
struct Qdisc_ops
{
{
	struct Qdisc_ops	*next;
	struct Qdisc_ops	*next;
	struct Qdisc_class_ops	*cl_ops;
	const struct Qdisc_class_ops	*cl_ops;
	char			id[IFNAMSIZ];
	char			id[IFNAMSIZ];
	int			priv_size;
	int			priv_size;


+2 −2
Original line number Original line Diff line number Diff line
@@ -527,7 +527,7 @@ static struct tcf_proto ** wme_classop_find_tcf(struct Qdisc *qd,


/* this qdisc is classful (i.e. has classes, some of which may have leaf qdiscs attached)
/* this qdisc is classful (i.e. has classes, some of which may have leaf qdiscs attached)
 * - these are the operations on the classes */
 * - these are the operations on the classes */
static struct Qdisc_class_ops class_ops =
static const struct Qdisc_class_ops class_ops =
{
{
	.graft = wme_classop_graft,
	.graft = wme_classop_graft,
	.leaf = wme_classop_leaf,
	.leaf = wme_classop_leaf,
@@ -547,7 +547,7 @@ static struct Qdisc_class_ops class_ops =




/* queueing discipline operations */
/* queueing discipline operations */
static struct Qdisc_ops wme_qdisc_ops =
static struct Qdisc_ops wme_qdisc_ops __read_mostly =
{
{
	.next = NULL,
	.next = NULL,
	.cl_ops = &class_ops,
	.cl_ops = &class_ops,
+2 −2
Original line number Original line Diff line number Diff line
@@ -130,7 +130,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
	struct tcf_proto **back, **chain;
	struct tcf_proto **back, **chain;
	struct tcf_proto *tp;
	struct tcf_proto *tp;
	struct tcf_proto_ops *tp_ops;
	struct tcf_proto_ops *tp_ops;
	struct Qdisc_class_ops *cops;
	const struct Qdisc_class_ops *cops;
	unsigned long cl;
	unsigned long cl;
	unsigned long fh;
	unsigned long fh;
	int err;
	int err;
@@ -382,7 +382,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
	struct tcf_proto *tp, **chain;
	struct tcf_proto *tp, **chain;
	struct tcmsg *tcm = (struct tcmsg*)NLMSG_DATA(cb->nlh);
	struct tcmsg *tcm = (struct tcmsg*)NLMSG_DATA(cb->nlh);
	unsigned long cl = 0;
	unsigned long cl = 0;
	struct Qdisc_class_ops *cops;
	const struct Qdisc_class_ops *cops;
	struct tcf_dump_args arg;
	struct tcf_dump_args arg;


	if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
	if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
+6 −6
Original line number Original line Diff line number Diff line
@@ -195,7 +195,7 @@ static struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
{
{
	unsigned long cl;
	unsigned long cl;
	struct Qdisc *leaf;
	struct Qdisc *leaf;
	struct Qdisc_class_ops *cops = p->ops->cl_ops;
	const struct Qdisc_class_ops *cops = p->ops->cl_ops;


	if (cops == NULL)
	if (cops == NULL)
		return NULL;
		return NULL;
@@ -373,7 +373,7 @@ dev_graft_qdisc(struct net_device *dev, struct Qdisc *qdisc)


void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
{
{
	struct Qdisc_class_ops *cops;
	const struct Qdisc_class_ops *cops;
	unsigned long cl;
	unsigned long cl;
	u32 parentid;
	u32 parentid;


@@ -417,7 +417,7 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
			*old = dev_graft_qdisc(dev, new);
			*old = dev_graft_qdisc(dev, new);
		}
		}
	} else {
	} else {
		struct Qdisc_class_ops *cops = parent->ops->cl_ops;
		const struct Qdisc_class_ops *cops = parent->ops->cl_ops;


		err = -EINVAL;
		err = -EINVAL;


@@ -581,7 +581,7 @@ static int
check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w)
check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w)
{
{
	struct Qdisc *leaf;
	struct Qdisc *leaf;
	struct Qdisc_class_ops *cops = q->ops->cl_ops;
	const struct Qdisc_class_ops *cops = q->ops->cl_ops;
	struct check_loop_arg *arg = (struct check_loop_arg *)w;
	struct check_loop_arg *arg = (struct check_loop_arg *)w;


	leaf = cops->leaf(q, cl);
	leaf = cops->leaf(q, cl);
@@ -924,7 +924,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
	struct rtattr **tca = arg;
	struct rtattr **tca = arg;
	struct net_device *dev;
	struct net_device *dev;
	struct Qdisc *q = NULL;
	struct Qdisc *q = NULL;
	struct Qdisc_class_ops *cops;
	const struct Qdisc_class_ops *cops;
	unsigned long cl = 0;
	unsigned long cl = 0;
	unsigned long new_cl;
	unsigned long new_cl;
	u32 pid = tcm->tcm_parent;
	u32 pid = tcm->tcm_parent;
@@ -1039,7 +1039,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
	struct nlmsghdr  *nlh;
	struct nlmsghdr  *nlh;
	unsigned char *b = skb_tail_pointer(skb);
	unsigned char *b = skb_tail_pointer(skb);
	struct gnet_dump d;
	struct gnet_dump d;
	struct Qdisc_class_ops *cl_ops = q->ops->cl_ops;
	const struct Qdisc_class_ops *cl_ops = q->ops->cl_ops;


	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
	tcm = NLMSG_DATA(nlh);
	tcm = NLMSG_DATA(nlh);
+2 −2
Original line number Original line Diff line number Diff line
@@ -668,7 +668,7 @@ static int atm_tc_dump(struct Qdisc *sch, struct sk_buff *skb)
	return 0;
	return 0;
}
}


static struct Qdisc_class_ops atm_class_ops = {
static const struct Qdisc_class_ops atm_class_ops = {
	.graft		= atm_tc_graft,
	.graft		= atm_tc_graft,
	.leaf		= atm_tc_leaf,
	.leaf		= atm_tc_leaf,
	.get		= atm_tc_get,
	.get		= atm_tc_get,
@@ -683,7 +683,7 @@ static struct Qdisc_class_ops atm_class_ops = {
	.dump_stats	= atm_tc_dump_class_stats,
	.dump_stats	= atm_tc_dump_class_stats,
};
};


static struct Qdisc_ops atm_qdisc_ops = {
static struct Qdisc_ops atm_qdisc_ops __read_mostly = {
	.cl_ops		= &atm_class_ops,
	.cl_ops		= &atm_class_ops,
	.id		= "atm",
	.id		= "atm",
	.priv_size	= sizeof(struct atm_qdisc_data),
	.priv_size	= sizeof(struct atm_qdisc_data),
Loading