Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278827
b: refs/heads/master
c: 869aa41
h: refs/heads/master
i:
  278825: 738f8bf
  278823: 9222a43
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Dec 16, 2011
1 parent 6975831 commit 2d9786e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c607b2ed84929e143d9fb5653c4b5d0109147cde
refs/heads/master: 869aa41044b04964e27822124b88f799e46f01b9
18 changes: 11 additions & 7 deletions trunk/net/sched/sch_gred.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,18 +380,19 @@ static inline int gred_change_table_def(struct Qdisc *sch, struct nlattr *dps)

static inline int gred_change_vq(struct Qdisc *sch, int dp,
struct tc_gred_qopt *ctl, int prio,
u8 *stab, u32 max_P)
u8 *stab, u32 max_P,
struct gred_sched_data **prealloc)
{
struct gred_sched *table = qdisc_priv(sch);
struct gred_sched_data *q;
struct gred_sched_data *q = table->tab[dp];

if (table->tab[dp] == NULL) {
table->tab[dp] = kzalloc(sizeof(*q), GFP_ATOMIC);
if (table->tab[dp] == NULL)
if (!q) {
table->tab[dp] = q = *prealloc;
*prealloc = NULL;
if (!q)
return -ENOMEM;
}

q = table->tab[dp];
q->DP = dp;
q->prio = prio;
q->limit = ctl->limit;
Expand Down Expand Up @@ -421,6 +422,7 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt)
int err, prio = GRED_DEF_PRIO;
u8 *stab;
u32 max_P;
struct gred_sched_data *prealloc;

if (opt == NULL)
return -EINVAL;
Expand Down Expand Up @@ -460,9 +462,10 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt)
prio = ctl->prio;
}

prealloc = kzalloc(sizeof(*prealloc), GFP_KERNEL);
sch_tree_lock(sch);

err = gred_change_vq(sch, ctl->DP, ctl, prio, stab, max_P);
err = gred_change_vq(sch, ctl->DP, ctl, prio, stab, max_P, &prealloc);
if (err < 0)
goto errout_locked;

Expand All @@ -476,6 +479,7 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt)

errout_locked:
sch_tree_unlock(sch);
kfree(prealloc);
errout:
return err;
}
Expand Down

0 comments on commit 2d9786e

Please sign in to comment.