Skip to content

Commit 7007ba6

Browse files
congwangdavem330
authored andcommitted
net_sched: implement ->change_tx_queue_len() for pfifo_fast
pfifo_fast used to drop based on qdisc_dev(qdisc)->tx_queue_len, so we have to resize skb array when we change tx_queue_len. Other qdiscs which read tx_queue_len are fine because they all save it to sch->limit or somewhere else in qdisc during init. They don't have to implement this, it is nicer if they do so that users don't have to re-configure qdisc after changing tx_queue_len. Cc: John Fastabend <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 48bfd55 commit 7007ba6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

net/sched/sch_generic.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,23 @@ static void pfifo_fast_destroy(struct Qdisc *sch)
763763
}
764764
}
765765

766+
static int pfifo_fast_change_tx_queue_len(struct Qdisc *sch,
767+
unsigned int new_len)
768+
{
769+
struct pfifo_fast_priv *priv = qdisc_priv(sch);
770+
struct skb_array *bands[PFIFO_FAST_BANDS];
771+
int prio;
772+
773+
for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
774+
struct skb_array *q = band2list(priv, prio);
775+
776+
bands[prio] = q;
777+
}
778+
779+
return skb_array_resize_multiple(bands, PFIFO_FAST_BANDS, new_len,
780+
GFP_KERNEL);
781+
}
782+
766783
struct Qdisc_ops pfifo_fast_ops __read_mostly = {
767784
.id = "pfifo_fast",
768785
.priv_size = sizeof(struct pfifo_fast_priv),
@@ -773,6 +790,7 @@ struct Qdisc_ops pfifo_fast_ops __read_mostly = {
773790
.destroy = pfifo_fast_destroy,
774791
.reset = pfifo_fast_reset,
775792
.dump = pfifo_fast_dump,
793+
.change_tx_queue_len = pfifo_fast_change_tx_queue_len,
776794
.owner = THIS_MODULE,
777795
.static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS,
778796
};

0 commit comments

Comments
 (0)