* configuration of pipes, schedulers, flowsets. * When we configure a new scheduler, an empty pipe is created, so: * * do_pipe = 1 -> "pipe N config ..." only for backward compatibility * sched N+Delta type fifo sched_mask ... * pipe N+Delta * flowset N+Delta pipe N+Delta (no parameters) * sched N type wf2q+ sched_mask ... * pipe N * * do_pipe = 2 -> flowset N c
| 1267 | * pipe ==> |
| 1268 | */ |
| 1269 | void |
| 1270 | ipfw_config_pipe(int ac, char **av) |
| 1271 | { |
| 1272 | int i; |
| 1273 | u_int j; |
| 1274 | char *end; |
| 1275 | struct dn_id *buf, *base; |
| 1276 | struct dn_sch *sch = NULL; |
| 1277 | struct dn_link *p = NULL; |
| 1278 | struct dn_fs *fs = NULL; |
| 1279 | struct dn_profile *pf = NULL; |
| 1280 | struct ipfw_flow_id *mask = NULL; |
| 1281 | #ifdef NEW_AQM |
| 1282 | struct dn_extra_parms *aqm_extra = NULL; |
| 1283 | struct dn_extra_parms *sch_extra = NULL; |
| 1284 | int lmax_extra; |
| 1285 | #endif |
| 1286 | |
| 1287 | int lmax; |
| 1288 | uint32_t _foo = 0, *flags = &_foo , *buckets = &_foo; |
| 1289 | |
| 1290 | /* |
| 1291 | * allocate space for 1 header, |
| 1292 | * 1 scheduler, 1 link, 1 flowset, 1 profile |
| 1293 | */ |
| 1294 | lmax = sizeof(struct dn_id); /* command header */ |
| 1295 | lmax += sizeof(struct dn_sch) + sizeof(struct dn_link) + |
| 1296 | sizeof(struct dn_fs) + sizeof(struct dn_profile); |
| 1297 | |
| 1298 | #ifdef NEW_AQM |
| 1299 | /* Extra Params */ |
| 1300 | lmax_extra = sizeof(struct dn_extra_parms); |
| 1301 | /* two lmax_extra because one for AQM params and another |
| 1302 | * sch params |
| 1303 | */ |
| 1304 | lmax += lmax_extra*2; |
| 1305 | #endif |
| 1306 | |
| 1307 | av++; ac--; |
| 1308 | /* Pipe number */ |
| 1309 | if (ac && isdigit(**av)) { |
| 1310 | i = atoi(*av); av++; ac--; |
| 1311 | } else |
| 1312 | i = -1; |
| 1313 | if (i <= 0) |
| 1314 | errx(EX_USAGE, "need a pipe/flowset/sched number"); |
| 1315 | base = buf = safe_calloc(1, lmax); |
| 1316 | /* all commands start with a 'CONFIGURE' and a version */ |
| 1317 | o_next(&buf, sizeof(struct dn_id), DN_CMD_CONFIG); |
| 1318 | base->id = DN_API_VERSION; |
| 1319 | |
| 1320 | switch (g_co.do_pipe) { |
| 1321 | case 1: /* "pipe N config ..." */ |
| 1322 | /* Allocate space for the WF2Q+ scheduler, its link |
| 1323 | * and the FIFO flowset. Set the number, but leave |
| 1324 | * the scheduler subtype and other parameters to 0 |
| 1325 | * so the kernel will use appropriate defaults. |
| 1326 | * XXX todo: add a flag to record if a parameter |
no test coverage detected