Merge git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
[linux-2.6-microblaze.git] / net / sched / cls_bpf.c
index 8e5326b..b07c1fa 100644 (file)
@@ -295,7 +295,7 @@ static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog,
 {
        struct cls_bpf_head *head = rtnl_dereference(tp->root);
 
-       idr_remove_ext(&head->handle_idr, prog->handle);
+       idr_remove(&head->handle_idr, prog->handle);
        cls_bpf_stop_offload(tp, prog, extack);
        list_del_rcu(&prog->link);
        tcf_unbind_filter(tp, &prog->res);
@@ -471,7 +471,6 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
        struct cls_bpf_prog *oldprog = *arg;
        struct nlattr *tb[TCA_BPF_MAX + 1];
        struct cls_bpf_prog *prog;
-       unsigned long idr_index;
        int ret;
 
        if (tca[TCA_OPTIONS] == NULL)
@@ -498,21 +497,18 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
        }
 
        if (handle == 0) {
-               ret = idr_alloc_ext(&head->handle_idr, prog, &idr_index,
-                                   1, 0x7FFFFFFF, GFP_KERNEL);
-               if (ret)
-                       goto errout;
-               prog->handle = idr_index;
-       } else {
-               if (!oldprog) {
-                       ret = idr_alloc_ext(&head->handle_idr, prog, &idr_index,
-                                           handle, handle + 1, GFP_KERNEL);
-                       if (ret)
-                               goto errout;
-               }
-               prog->handle = handle;
+               handle = 1;
+               ret = idr_alloc_u32(&head->handle_idr, prog, &handle,
+                                   INT_MAX, GFP_KERNEL);
+       } else if (!oldprog) {
+               ret = idr_alloc_u32(&head->handle_idr, prog, &handle,
+                                   handle, GFP_KERNEL);
        }
 
+       if (ret)
+               goto errout;
+       prog->handle = handle;
+
        ret = cls_bpf_set_parms(net, tp, prog, base, tb, tca[TCA_RATE], ovr,
                                extack);
        if (ret < 0)
@@ -526,7 +522,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
                prog->gen_flags |= TCA_CLS_FLAGS_NOT_IN_HW;
 
        if (oldprog) {
-               idr_replace_ext(&head->handle_idr, prog, handle);
+               idr_replace(&head->handle_idr, prog, handle);
                list_replace_rcu(&oldprog->link, &prog->link);
                tcf_unbind_filter(tp, &oldprog->res);
                tcf_exts_get_net(&oldprog->exts);
@@ -542,7 +538,7 @@ errout_parms:
        cls_bpf_free_parms(prog);
 errout_idr:
        if (!oldprog)
-               idr_remove_ext(&head->handle_idr, prog->handle);
+               idr_remove(&head->handle_idr, prog->handle);
 errout:
        tcf_exts_destroy(&prog->exts);
        kfree(prog);