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

Commit 1e90474c authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[NET_SCHED]: Convert packet schedulers from rtnetlink to new netlink API



Convert packet schedulers to use the netlink API. Unfortunately a gradual
conversion is not possible without breaking compilation in the middle or
adding lots of casts, so this patch converts them all in one step. The
patch has been mostly generated automatically with some minor edits to
at least allow seperate conversion of classifiers and actions.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 01480e1c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ struct gnet_dump
{
	spinlock_t *      lock;
	struct sk_buff *  skb;
	struct rtattr *   tail;
	struct nlattr *   tail;

	/* Backward compatability */
	int               compat_tc_stats;
@@ -39,11 +39,11 @@ extern int gnet_stats_finish_copy(struct gnet_dump *d);

extern int gen_new_estimator(struct gnet_stats_basic *bstats,
			     struct gnet_stats_rate_est *rate_est,
			     spinlock_t *stats_lock, struct rtattr *opt);
			     spinlock_t *stats_lock, struct nlattr *opt);
extern void gen_kill_estimator(struct gnet_stats_basic *bstats,
			       struct gnet_stats_rate_est *rate_est);
extern int gen_replace_estimator(struct gnet_stats_basic *bstats,
				 struct gnet_stats_rate_est *rate_est,
				 spinlock_t *stats_lock, struct rtattr *opt);
				 spinlock_t *stats_lock, struct nlattr *opt);

#endif
+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ extern int unregister_qdisc(struct Qdisc_ops *qops);
extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
		struct rtattr *tab);
		struct nlattr *tab);
extern void qdisc_put_rtab(struct qdisc_rate_table *tab);

extern void __qdisc_run(struct net_device *dev);
+3 −3
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ struct Qdisc_class_ops
	unsigned long		(*get)(struct Qdisc *, u32 classid);
	void			(*put)(struct Qdisc *, unsigned long);
	int			(*change)(struct Qdisc *, u32, u32,
					struct rtattr **, unsigned long *);
					struct nlattr **, unsigned long *);
	int			(*delete)(struct Qdisc *, unsigned long);
	void			(*walk)(struct Qdisc *, struct qdisc_walker * arg);

@@ -95,10 +95,10 @@ struct Qdisc_ops
	int 			(*requeue)(struct sk_buff *, struct Qdisc *);
	unsigned int		(*drop)(struct Qdisc *);

	int			(*init)(struct Qdisc *, struct rtattr *arg);
	int			(*init)(struct Qdisc *, struct nlattr *arg);
	void			(*reset)(struct Qdisc *);
	void			(*destroy)(struct Qdisc *);
	int			(*change)(struct Qdisc *, struct rtattr *arg);
	int			(*change)(struct Qdisc *, struct nlattr *arg);

	int			(*dump)(struct Qdisc *, struct sk_buff *);
	int			(*dump_stats)(struct Qdisc *, struct gnet_dump *);
+4 −4
Original line number Diff line number Diff line
@@ -159,13 +159,13 @@ skip:
int gen_new_estimator(struct gnet_stats_basic *bstats,
		      struct gnet_stats_rate_est *rate_est,
		      spinlock_t *stats_lock,
		      struct rtattr *opt)
		      struct nlattr *opt)
{
	struct gen_estimator *est;
	struct gnet_estimator *parm = RTA_DATA(opt);
	struct gnet_estimator *parm = nla_data(opt);
	int idx;

	if (RTA_PAYLOAD(opt) < sizeof(*parm))
	if (nla_len(opt) < sizeof(*parm))
		return -EINVAL;

	if (parm->interval < -2 || parm->interval > 3)
@@ -254,7 +254,7 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats,
 */
int gen_replace_estimator(struct gnet_stats_basic *bstats,
			  struct gnet_stats_rate_est *rate_est,
			  spinlock_t *stats_lock, struct rtattr *opt)
			  spinlock_t *stats_lock, struct nlattr *opt)
{
	gen_kill_estimator(bstats, rate_est);
	return gen_new_estimator(bstats, rate_est, stats_lock, opt);
+5 −4
Original line number Diff line number Diff line
@@ -20,16 +20,17 @@
#include <linux/socket.h>
#include <linux/rtnetlink.h>
#include <linux/gen_stats.h>
#include <net/netlink.h>
#include <net/gen_stats.h>


static inline int
gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size)
{
	RTA_PUT(d->skb, type, size, buf);
	NLA_PUT(d->skb, type, size, buf);
	return 0;

rtattr_failure:
nla_put_failure:
	spin_unlock_bh(d->lock);
	return -1;
}
@@ -62,7 +63,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
	spin_lock_bh(lock);
	d->lock = lock;
	if (type)
		d->tail = (struct rtattr *)skb_tail_pointer(skb);
		d->tail = (struct nlattr *)skb_tail_pointer(skb);
	d->skb = skb;
	d->compat_tc_stats = tc_stats_type;
	d->compat_xstats = xstats_type;
@@ -213,7 +214,7 @@ int
gnet_stats_finish_copy(struct gnet_dump *d)
{
	if (d->tail)
		d->tail->rta_len = skb_tail_pointer(d->skb) - (u8 *)d->tail;
		d->tail->nla_len = skb_tail_pointer(d->skb) - (u8 *)d->tail;

	if (d->compat_tc_stats)
		if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats,
Loading