Lines Matching defs:fs
284 p->fs.fs_nr = user_pipe_32.fs.fs_nr;
285 p->fs.flags_fs = user_pipe_32.fs.flags_fs;
286 p->fs.parent_nr = user_pipe_32.fs.parent_nr;
287 p->fs.weight = user_pipe_32.fs.weight;
288 p->fs.qsize = user_pipe_32.fs.qsize;
289 p->fs.plr = user_pipe_32.fs.plr;
290 p->fs.flow_mask = user_pipe_32.fs.flow_mask;
291 p->fs.rq_size = user_pipe_32.fs.rq_size;
292 p->fs.rq_elements = user_pipe_32.fs.rq_elements;
293 p->fs.last_expired = user_pipe_32.fs.last_expired;
294 p->fs.backlogged = user_pipe_32.fs.backlogged;
295 p->fs.w_q = user_pipe_32.fs.w_q;
296 p->fs.max_th = user_pipe_32.fs.max_th;
297 p->fs.min_th = user_pipe_32.fs.min_th;
298 p->fs.max_p = user_pipe_32.fs.max_p;
299 p->fs.c_1 = user_pipe_32.fs.c_1;
300 p->fs.c_2 = user_pipe_32.fs.c_2;
301 p->fs.c_3 = user_pipe_32.fs.c_3;
302 p->fs.c_4 = user_pipe_32.fs.c_4;
303 p->fs.lookup_depth = user_pipe_32.fs.lookup_depth;
304 p->fs.lookup_step = user_pipe_32.fs.lookup_step;
305 p->fs.lookup_weight = user_pipe_32.fs.lookup_weight;
306 p->fs.avg_pkt_size = user_pipe_32.fs.avg_pkt_size;
307 p->fs.max_pkt_size = user_pipe_32.fs.max_pkt_size;
330 p->fs.fs_nr = user_pipe_64.fs.fs_nr;
331 p->fs.flags_fs = user_pipe_64.fs.flags_fs;
332 p->fs.parent_nr = user_pipe_64.fs.parent_nr;
333 p->fs.weight = user_pipe_64.fs.weight;
334 p->fs.qsize = user_pipe_64.fs.qsize;
335 p->fs.plr = user_pipe_64.fs.plr;
336 p->fs.flow_mask = user_pipe_64.fs.flow_mask;
337 p->fs.rq_size = user_pipe_64.fs.rq_size;
338 p->fs.rq_elements = user_pipe_64.fs.rq_elements;
339 p->fs.last_expired = user_pipe_64.fs.last_expired;
340 p->fs.backlogged = user_pipe_64.fs.backlogged;
341 p->fs.w_q = user_pipe_64.fs.w_q;
342 p->fs.max_th = user_pipe_64.fs.max_th;
343 p->fs.min_th = user_pipe_64.fs.min_th;
344 p->fs.max_p = user_pipe_64.fs.max_p;
345 p->fs.c_1 = user_pipe_64.fs.c_1;
346 p->fs.c_2 = user_pipe_64.fs.c_2;
347 p->fs.c_3 = user_pipe_64.fs.c_3;
348 p->fs.c_4 = user_pipe_64.fs.c_4;
349 p->fs.lookup_depth = user_pipe_64.fs.lookup_depth;
350 p->fs.lookup_step = user_pipe_64.fs.lookup_step;
351 p->fs.lookup_weight = user_pipe_64.fs.lookup_weight;
352 p->fs.avg_pkt_size = user_pipe_64.fs.avg_pkt_size;
353 p->fs.max_pkt_size = user_pipe_64.fs.max_pkt_size;
482 cp_flow_set_to_32_user( &(p->fs), &(pipe_bp->fs));
494 pipe_bp->fs.next = (user32_addr_t)0 ;
495 pipe_bp->fs.pipe = (user32_addr_t)0 ;
496 pipe_bp->fs.rq = (user32_addr_t)0 ;
498 return( dn_copy_set_32( &(p->fs), bp) );
523 cp_flow_set_to_64_user( &(p->fs), &(pipe_bp->fs));
535 pipe_bp->fs.next = USER_ADDR_NULL ;
536 pipe_bp->fs.pipe = USER_ADDR_NULL ;
537 pipe_bp->fs.rq = USER_ADDR_NULL ;
539 return( dn_copy_set_64( &(p->fs), bp) );
815 struct dn_pipe *p = q->fs->pipe ;
906 struct dn_flow_set *fs = q->fs;
917 fs->backlogged-- ;
925 q->F += (len<<MY_M)/(u_int64_t) fs->weight ;
1064 pe->sum -= q->fs->weight ;
1207 expire_queues(struct dn_flow_set *fs)
1210 int i, initial_elements = fs->rq_elements ;
1216 if (fs->last_expired == timenow.tv_sec)
1218 fs->last_expired = timenow.tv_sec ;
1219 for (i = 0 ; i <= fs->rq_size ; i++) /* last one is overflow */
1220 for (prev=NULL, q = fs->rq[i] ; q != NULL ; )
1230 fs->rq[i] = q = q->next ;
1231 fs->rq_elements-- ;
1234 return initial_elements - fs->rq_elements ;
1242 create_queue(struct dn_flow_set *fs, int i)
1246 if (fs->rq_elements > fs->rq_size * dn_max_ratio &&
1247 expire_queues(fs) == 0) {
1251 i = fs->rq_size ;
1252 if ( fs->rq[i] != NULL )
1253 return fs->rq[i] ;
1260 q->fs = fs ;
1262 q->next = fs->rq[i] ;
1264 fs->rq[i] = q ;
1265 fs->rq_elements++ ;
1275 find_queue(struct dn_flow_set *fs, struct ip_flow_id *id)
1281 if ( !(fs->flags_fs & DN_HAVE_FLOW_MASK) )
1282 q = fs->rq[0] ;
1285 id->dst_port &= fs->flow_mask.dst_port ;
1286 id->src_port &= fs->flow_mask.src_port ;
1287 id->proto &= fs->flow_mask.proto ;
1290 APPLY_MASK(&id->dst_ip6, &fs->flow_mask.dst_ip6);
1291 APPLY_MASK(&id->src_ip6, &fs->flow_mask.src_ip6);
1292 id->flow_id6 &= fs->flow_mask.flow_id6;
1318 id->dst_ip &= fs->flow_mask.dst_ip ;
1319 id->src_ip &= fs->flow_mask.src_ip ;
1328 i = i % fs->rq_size ;
1331 for (prev=NULL, q = fs->rq[i] ; q ; ) {
1359 fs->rq[i] = q = q->next ;
1360 fs->rq_elements-- ;
1369 q->next = fs->rq[i] ;
1370 fs->rq[i] = q ;
1374 q = create_queue(fs, i);
1382 red_drops(struct dn_flow_set *fs, struct dn_flow_queue *q, int len)
1404 u_int q_size = (fs->flags_fs & DN_QSIZE_IS_BYTES) ? q->len_bytes : q->len;
1414 int64_t v = SCALE_MUL((int64_t) diff, (int64_t) fs->w_q);
1426 u_int t = (curr_time - q->q_time) / fs->lookup_step;
1428 q->avg = (t < fs->lookup_depth) ?
1429 SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0;
1436 if (q->avg < fs->min_th) {
1440 if (q->avg >= fs->max_th) { /* average queue >= max threshold */
1441 if (fs->flags_fs & DN_IS_GENTLE_RED) {
1448 p_b = SCALE_MUL((int64_t) fs->c_3, (int64_t) q->avg) - fs->c_4;
1454 } else if (q->avg > fs->min_th) {
1460 p_b = SCALE_MUL((int64_t) fs->c_1, (int64_t) q->avg) - fs->c_2;
1462 if (fs->flags_fs & DN_QSIZE_IS_BYTES)
1463 p_b = (p_b * len) / fs->max_pkt_size;
1487 struct dn_flow_set *fs;
1488 SLIST_FOREACH(fs, &flowsethash[HASH(fs_nr)], next)
1489 if (fs->fs_nr == fs_nr)
1490 return fs ;
1531 struct dn_flow_set *fs = NULL;
1579 fs = &(pipe->fs);
1581 fs = locate_flowset(pipe_nr);
1584 if (fs == NULL){
1587 pipe = fs->pipe ;
1589 pipe = locate_pipe(fs->parent_nr);
1592 fs->pipe = pipe ;
1595 fs->parent_nr, fs->fs_nr);
1599 q = find_queue(fs, &(fwa->fwa_id));
1607 if ( fs->plr && (MY_RANDOM < fs->plr) )
1609 if ( fs->flags_fs & DN_QSIZE_IS_BYTES) {
1610 if (q->len_bytes > fs->qsize)
1613 if (q->len >= fs->qsize)
1616 if ( fs->flags_fs & DN_IS_RED && red_drops(fs, q, len) )
1733 pipe->sum += fs->weight ; /* add weight of new queue */
1738 q->F = q->S + ( len<<MY_M )/(u_int64_t) fs->weight;
1743 fs->backlogged++ ;
1795 return ( (fs && (fs->flags_fs & DN_NOERROR)) ? 0 : ENOBUFS);
1822 purge_flow_set(struct dn_flow_set *fs, int all)
1829 for (i = 0 ; i <= fs->rq_size ; i++ ) {
1830 for (q = fs->rq[i] ; q ; q = qn ) {
1841 fs->rq[i] = NULL ;
1843 fs->rq_elements = 0 ;
1846 if (fs->w_q_lookup)
1847 FREE(fs->w_q_lookup, M_DUMMYNET);
1848 if (fs->rq)
1849 FREE(fs->rq, M_DUMMYNET);
1850 /* if this fs is not part of a pipe, free it */
1851 if (fs->pipe && fs != &(fs->pipe->fs) )
1852 FREE(fs, M_DUMMYNET);
1866 purge_flow_set( &(pipe->fs), 1 );
1887 struct dn_flow_set *fs, *fs1;
1908 SLIST_FOREACH_SAFE(fs, &flowsethash[i], next, fs1) {
1909 SLIST_REMOVE(&flowsethash[i], fs, dn_flow_set, next);
1910 purge_flow_set(fs, 1);
1923 dn_ipfw_rule_delete_fs(struct dn_flow_set *fs, void *r)
1929 for (i = 0 ; i <= fs->rq_size ; i++) /* last one is ovflow */
1930 for (q = fs->rq[i] ; q ; q = q->next )
1945 struct dn_flow_set *fs ;
1958 SLIST_FOREACH(fs, &flowsethash[i], next)
1959 dn_ipfw_rule_delete_fs(fs, r);
1963 fs = &(p->fs);
1964 dn_ipfw_rule_delete_fs(fs, r);
2082 struct dn_flow_set *pfs = &(p->fs);
2113 x->fs.pipe = x ;
2121 for (i = 0; i <= x->fs.rq_size; i++)
2122 for (q = x->fs.rq[i]; q; q = q->next)
2131 set_fs_parms(&(x->fs), pfs);
2134 if ( x->fs.rq == NULL ) { /* a new pipe */
2135 r = alloc_hash(&(x->fs), pfs) ;
2200 fs_remove_from_heap(struct dn_heap *h, struct dn_flow_set *fs)
2204 if ( ((struct dn_flow_queue *)h->p[i].object)->fs == fs) {
2239 struct dn_flow_set *fs;
2251 SLIST_FOREACH(fs, &flowsethash[i], next)
2252 purge_flow_set(fs, 0);
2256 purge_flow_set(&(p->fs), 0);
2273 if (p->pipe_nr == 0 && p->fs.fs_nr == 0)
2275 if (p->pipe_nr != 0 && p->fs.fs_nr != 0)
2279 struct dn_flow_set *fs;
2295 flush_pipe_ptrs(&(b->fs));
2300 SLIST_FOREACH(fs, &flowsethash[i], next)
2301 if (fs->pipe == b) {
2302 printf("dummynet: ++ ref to pipe %d from fs %d\n",
2303 p->pipe_nr, fs->fs_nr);
2304 fs->pipe = NULL ;
2305 purge_flow_set(fs, 0);
2307 fs_remove_from_heap(&ready_heap, &(b->fs));
2321 b = locate_flowset(p->fs.fs_nr);
2367 if (q->fs != set)
2368 printf("dummynet: ++ at %d: wrong fs ptr (have %p, should be %p)\n",
2369 i, q->fs, set);
2375 qp->fs = (user32_addr_t)0 ;
2397 if (q->fs != set)
2398 printf("dummynet: ++ at %d: wrong fs ptr (have %p, should be %p)\n",
2399 i, q->fs, set);
2406 qp->fs = USER_ADDR_NULL ;
2442 p->fs.rq_elements * sizeof(struct dn_flow_queue);