aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 01:11:17 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:10 -0500
commit1e90474c377e92db7262a8968a45c1dd980ca9e5 (patch)
tree645af56dcb17cf1a76fd3b7f1a8b833a3fffc3d7 /net/core
parent01480e1cf5e2118eba8a8968239f3242072f9563 (diff)
[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: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/gen_estimator.c8
-rw-r--r--net/core/gen_stats.c9
2 files changed, 9 insertions, 8 deletions
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 7ab9060bccd0..57abe8266be1 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -159,13 +159,13 @@ skip:
159int gen_new_estimator(struct gnet_stats_basic *bstats, 159int gen_new_estimator(struct gnet_stats_basic *bstats,
160 struct gnet_stats_rate_est *rate_est, 160 struct gnet_stats_rate_est *rate_est,
161 spinlock_t *stats_lock, 161 spinlock_t *stats_lock,
162 struct rtattr *opt) 162 struct nlattr *opt)
163{ 163{
164 struct gen_estimator *est; 164 struct gen_estimator *est;
165 struct gnet_estimator *parm = RTA_DATA(opt); 165 struct gnet_estimator *parm = nla_data(opt);
166 int idx; 166 int idx;
167 167
168 if (RTA_PAYLOAD(opt) < sizeof(*parm)) 168 if (nla_len(opt) < sizeof(*parm))
169 return -EINVAL; 169 return -EINVAL;
170 170
171 if (parm->interval < -2 || parm->interval > 3) 171 if (parm->interval < -2 || parm->interval > 3)
@@ -254,7 +254,7 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats,
254 */ 254 */
255int gen_replace_estimator(struct gnet_stats_basic *bstats, 255int gen_replace_estimator(struct gnet_stats_basic *bstats,
256 struct gnet_stats_rate_est *rate_est, 256 struct gnet_stats_rate_est *rate_est,
257 spinlock_t *stats_lock, struct rtattr *opt) 257 spinlock_t *stats_lock, struct nlattr *opt)
258{ 258{
259 gen_kill_estimator(bstats, rate_est); 259 gen_kill_estimator(bstats, rate_est);
260 return gen_new_estimator(bstats, rate_est, stats_lock, opt); 260 return gen_new_estimator(bstats, rate_est, stats_lock, opt);
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 8073561f7c63..c3d0ffeac243 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -20,16 +20,17 @@
20#include <linux/socket.h> 20#include <linux/socket.h>
21#include <linux/rtnetlink.h> 21#include <linux/rtnetlink.h>
22#include <linux/gen_stats.h> 22#include <linux/gen_stats.h>
23#include <net/netlink.h>
23#include <net/gen_stats.h> 24#include <net/gen_stats.h>
24 25
25 26
26static inline int 27static inline int
27gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size) 28gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size)
28{ 29{
29 RTA_PUT(d->skb, type, size, buf); 30 NLA_PUT(d->skb, type, size, buf);
30 return 0; 31 return 0;
31 32
32rtattr_failure: 33nla_put_failure:
33 spin_unlock_bh(d->lock); 34 spin_unlock_bh(d->lock);
34 return -1; 35 return -1;
35} 36}
@@ -62,7 +63,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
62 spin_lock_bh(lock); 63 spin_lock_bh(lock);
63 d->lock = lock; 64 d->lock = lock;
64 if (type) 65 if (type)
65 d->tail = (struct rtattr *)skb_tail_pointer(skb); 66 d->tail = (struct nlattr *)skb_tail_pointer(skb);
66 d->skb = skb; 67 d->skb = skb;
67 d->compat_tc_stats = tc_stats_type; 68 d->compat_tc_stats = tc_stats_type;
68 d->compat_xstats = xstats_type; 69 d->compat_xstats = xstats_type;
@@ -213,7 +214,7 @@ int
213gnet_stats_finish_copy(struct gnet_dump *d) 214gnet_stats_finish_copy(struct gnet_dump *d)
214{ 215{
215 if (d->tail) 216 if (d->tail)
216 d->tail->rta_len = skb_tail_pointer(d->skb) - (u8 *)d->tail; 217 d->tail->nla_len = skb_tail_pointer(d->skb) - (u8 *)d->tail;
217 218
218 if (d->compat_tc_stats) 219 if (d->compat_tc_stats)
219 if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats, 220 if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats,