Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178336804
D61256.1796522580.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D61256.1796522580.diff
View Options
diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c
--- a/sys/netpfil/ipfw/ip_dummynet.c
+++ b/sys/netpfil/ipfw/ip_dummynet.c
@@ -715,8 +715,11 @@
{
struct dn_sch_inst *si;
- /* clean up AQM status for all queues for !DN_MULTIQUEUE sched*/
- if (fs->fs.fs_nr > DN_MAX_ID) {
+ /*
+ * clean up AQM status for all queues for !DN_MULTIQUEUE sched,
+ * they belong to the scheduler's own flowset (see si_new()).
+ */
+ if (fs->sched && fs->sched->fs == fs) {
if (fs->sched && !(fs->sched->fp->flags & DN_MULTIQUEUE)) {
if (fs->sched->sch.flags & DN_HAVE_MASK)
dn_ht_scan(fs->sched->siht, si_cleanup_q, NULL);
@@ -741,6 +744,62 @@
if(fs->aqmcfg && fs->aqmfp && fs->aqmfp->deconfig)
fs->aqmfp->deconfig(fs);
}
+
+/* Init AQM status for queue 'q' of flowset 'fs', unless it has one. */
+static void
+aqm_init_q(struct dn_fsk *fs, struct dn_queue *q)
+{
+ if (q->aqm_status == NULL && fs->aqmfp->init(q))
+ D("unable to init AQM for fs %d", fs->fs.fs_nr);
+}
+
+/* callback to init AQM status for a !DN_MULTIQUEUE sched instance */
+static int
+si_init_q(void *_si, void *arg)
+{
+ struct dn_sch_inst *si = _si;
+
+ aqm_init_q(arg, (struct dn_queue *)(si + 1));
+ return (0);
+}
+
+/* callback to init AQM status for a DN_MULTIQUEUE queue */
+static int
+q_init_q(void *_q, void *arg)
+{
+ aqm_init_q(arg, _q);
+ return (0);
+}
+
+/*
+ * Init AQM status for the queues that already exist for flowset 'fs',
+ * after aqm_cleanup_deconfig_fs() and a new AQM config. New queues get
+ * theirs from si_new() and q_new(); this covers the same queues for a
+ * flowset that is reconfigured while it has traffic.
+ */
+static void
+aqm_init_fs(struct dn_fsk *fs)
+{
+ struct dn_schk *s = fs->sched;
+
+ if (s == NULL || fs->aqmfp == NULL || fs->aqmfp->init == NULL)
+ return;
+
+ if (!(s->fp->flags & DN_MULTIQUEUE)) {
+ /* the queue is in each instance, see si_new() */
+ if (s->fs != fs)
+ return;
+ if (s->sch.flags & DN_HAVE_MASK)
+ dn_ht_scan(s->siht, si_init_q, fs);
+ else if (s->siht != NULL)
+ si_init_q(s->siht, fs);
+ } else if (fs->qht != NULL) {
+ if (fs->fs.flags & DN_QHT_HASH)
+ dn_ht_scan(fs->qht, q_init_q, fs);
+ else
+ q_init_q(fs->qht, fs);
+ }
+}
#endif
/*
@@ -1477,7 +1536,7 @@
* extra parameters are passed from userland.
*/
static int
-config_aqm(struct dn_fsk *fs, struct dn_extra_parms *ep, int busy)
+config_aqm(struct dn_fsk *fs, struct dn_extra_parms *ep)
{
int err = 0;
@@ -1501,12 +1560,6 @@
break;
}
- if (busy) {
- D("Unable to configure flowset, flowset busy!");
- err = EINVAL;
- break;
- }
-
/* deconfigure old aqm if exist */
if (fs->aqmcfg && fs->aqmfp && fs->aqmfp->deconfig) {
aqm_cleanup_deconfig_fs(fs);
@@ -1535,6 +1588,8 @@
break;
}
}
+ /* queues that already exist need the new AQM status */
+ aqm_init_fs(fs);
} while(0);
return err;
@@ -1685,15 +1740,9 @@
if (bcmp(&fs->fs, nfs, sizeof(*nfs)) == 0) {
ND("flowset %d unchanged", i);
#ifdef NEW_AQM
- if (ep != NULL) {
- /*
- * Reconfigure AQM as the parameters can be changed.
- * We consider the flowset as busy if it has scheduler
- * instance(s).
- */
- s = locate_scheduler(nfs->sched_nr);
- config_aqm(fs, ep, s != NULL && s->siht != NULL);
- }
+ /* Reconfigure AQM as the parameters can be changed. */
+ if (ep != NULL)
+ config_aqm(fs, ep);
#endif
break; /* no change, nothing to do */
}
@@ -1713,14 +1762,17 @@
fsk_detach(fs, flags);
}
fs->fs = *nfs; /* copy configuration */
-#ifdef NEW_AQM
- fs->aqmfp = NULL;
- if (ep != NULL)
- config_aqm(fs, ep, s != NULL &&
- s->siht != NULL);
-#endif
if (s != NULL)
fsk_attach(fs, s);
+#ifdef NEW_AQM
+ /*
+ * After fsk_attach(), so that queues of a !DN_MULTIQUEUE
+ * scheduler that survived fsk_detach() get a new AQM status.
+ */
+ fs->aqmfp = NULL;
+ if (ep != NULL)
+ config_aqm(fs, ep);
+#endif
} while (0);
if (!locked)
DN_BH_WUNLOCK();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 6, 2:03 AM (5 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42238270
Default Alt Text
D61256.1796522580.diff (3 KB)
Attached To
Mode
D61256: dummynet: Allow AQM reconfiguration of flowsets with traffic
Attached
Detach File
Event Timeline