Loading net/sched/cls_u32.c +10 −13 Original line number Original line Diff line number Diff line Loading @@ -740,19 +740,17 @@ static int u32_delete(struct tcf_proto *tp, void *arg, bool *last, static u32 gen_new_kid(struct tc_u_hnode *ht, u32 htid) static u32 gen_new_kid(struct tc_u_hnode *ht, u32 htid) { { unsigned long idr_index; u32 index = htid | 0x800; u32 start = htid | 0x800; u32 max = htid | 0xFFF; u32 max = htid | 0xFFF; u32 min = htid; if (idr_alloc_ext(&ht->handle_idr, NULL, &idr_index, if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, GFP_KERNEL)) { start, max + 1, GFP_KERNEL)) { index = htid + 1; if (idr_alloc_ext(&ht->handle_idr, NULL, &idr_index, if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, min + 1, max + 1, GFP_KERNEL)) GFP_KERNEL)) return max; index = max; } } return (u32)idr_index; return index; } } static const struct nla_policy u32_policy[TCA_U32_MAX + 1] = { static const struct nla_policy u32_policy[TCA_U32_MAX + 1] = { Loading Loading @@ -1003,8 +1001,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, return -ENOMEM; return -ENOMEM; } } } else { } else { err = idr_alloc_ext(&tp_c->handle_idr, ht, NULL, err = idr_alloc_u32(&tp_c->handle_idr, ht, &handle, handle, handle + 1, GFP_KERNEL); handle, GFP_KERNEL); if (err) { if (err) { kfree(ht); kfree(ht); return err; return err; Loading Loading @@ -1060,8 +1058,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, return -EINVAL; return -EINVAL; } } handle = htid | TC_U32_NODE(handle); handle = htid | TC_U32_NODE(handle); err = idr_alloc_ext(&ht->handle_idr, NULL, NULL, err = idr_alloc_u32(&ht->handle_idr, NULL, &handle, handle, handle, handle + 1, GFP_KERNEL); GFP_KERNEL); if (err) if (err) return err; return err; Loading Loading
net/sched/cls_u32.c +10 −13 Original line number Original line Diff line number Diff line Loading @@ -740,19 +740,17 @@ static int u32_delete(struct tcf_proto *tp, void *arg, bool *last, static u32 gen_new_kid(struct tc_u_hnode *ht, u32 htid) static u32 gen_new_kid(struct tc_u_hnode *ht, u32 htid) { { unsigned long idr_index; u32 index = htid | 0x800; u32 start = htid | 0x800; u32 max = htid | 0xFFF; u32 max = htid | 0xFFF; u32 min = htid; if (idr_alloc_ext(&ht->handle_idr, NULL, &idr_index, if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, GFP_KERNEL)) { start, max + 1, GFP_KERNEL)) { index = htid + 1; if (idr_alloc_ext(&ht->handle_idr, NULL, &idr_index, if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, min + 1, max + 1, GFP_KERNEL)) GFP_KERNEL)) return max; index = max; } } return (u32)idr_index; return index; } } static const struct nla_policy u32_policy[TCA_U32_MAX + 1] = { static const struct nla_policy u32_policy[TCA_U32_MAX + 1] = { Loading Loading @@ -1003,8 +1001,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, return -ENOMEM; return -ENOMEM; } } } else { } else { err = idr_alloc_ext(&tp_c->handle_idr, ht, NULL, err = idr_alloc_u32(&tp_c->handle_idr, ht, &handle, handle, handle + 1, GFP_KERNEL); handle, GFP_KERNEL); if (err) { if (err) { kfree(ht); kfree(ht); return err; return err; Loading Loading @@ -1060,8 +1058,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, return -EINVAL; return -EINVAL; } } handle = htid | TC_U32_NODE(handle); handle = htid | TC_U32_NODE(handle); err = idr_alloc_ext(&ht->handle_idr, NULL, NULL, err = idr_alloc_u32(&ht->handle_idr, NULL, &handle, handle, handle, handle + 1, GFP_KERNEL); GFP_KERNEL); if (err) if (err) return err; return err; Loading