Lines Matching refs:gact

21 static ktime_t gate_get_time(struct tcf_gate *gact)  in gate_get_time()  argument
25 switch (gact->tk_offset) { in gate_get_time()
29 return ktime_mono_to_any(mono, gact->tk_offset); in gate_get_time()
35 static void gate_get_start_time(struct tcf_gate *gact, ktime_t *start) in gate_get_start_time() argument
37 struct tcf_gate_params *param = &gact->param; in gate_get_start_time()
42 now = gate_get_time(gact); in gate_get_start_time()
55 static void gate_start_timer(struct tcf_gate *gact, ktime_t start) in gate_start_timer() argument
59 expires = hrtimer_get_expires(&gact->hitimer); in gate_start_timer()
65 hrtimer_start(&gact->hitimer, start, HRTIMER_MODE_ABS_SOFT); in gate_start_timer()
70 struct tcf_gate *gact = container_of(timer, struct tcf_gate, in gate_timer_func() local
72 struct tcf_gate_params *p = &gact->param; in gate_timer_func()
76 spin_lock(&gact->tcf_lock); in gate_timer_func()
78 next = gact->next_entry; in gate_timer_func()
81 gact->current_gate_status = next->gate_state ? GATE_ACT_GATE_OPEN : 0; in gate_timer_func()
82 gact->current_entry_octets = 0; in gate_timer_func()
83 gact->current_max_octets = next->maxoctets; in gate_timer_func()
85 gact->current_close_time = ktime_add_ns(gact->current_close_time, in gate_timer_func()
88 close_time = gact->current_close_time; in gate_timer_func()
96 now = gate_get_time(gact); in gate_timer_func()
108 gact->next_entry = next; in gate_timer_func()
110 hrtimer_set_expires(&gact->hitimer, close_time); in gate_timer_func()
112 spin_unlock(&gact->tcf_lock); in gate_timer_func()
120 struct tcf_gate *gact = to_gate(a); in tcf_gate_act() local
122 spin_lock(&gact->tcf_lock); in tcf_gate_act()
124 tcf_lastuse_update(&gact->tcf_tm); in tcf_gate_act()
125 bstats_update(&gact->tcf_bstats, skb); in tcf_gate_act()
127 if (unlikely(gact->current_gate_status & GATE_ACT_PENDING)) { in tcf_gate_act()
128 spin_unlock(&gact->tcf_lock); in tcf_gate_act()
129 return gact->tcf_action; in tcf_gate_act()
132 if (!(gact->current_gate_status & GATE_ACT_GATE_OPEN)) in tcf_gate_act()
135 if (gact->current_max_octets >= 0) { in tcf_gate_act()
136 gact->current_entry_octets += qdisc_pkt_len(skb); in tcf_gate_act()
137 if (gact->current_entry_octets > gact->current_max_octets) { in tcf_gate_act()
138 gact->tcf_qstats.overlimits++; in tcf_gate_act()
143 spin_unlock(&gact->tcf_lock); in tcf_gate_act()
145 return gact->tcf_action; in tcf_gate_act()
147 gact->tcf_qstats.drops++; in tcf_gate_act()
148 spin_unlock(&gact->tcf_lock); in tcf_gate_act()
275 static void gate_setup_timer(struct tcf_gate *gact, u64 basetime, in gate_setup_timer() argument
280 if (basetime == gact->param.tcfg_basetime && in gate_setup_timer()
281 tko == gact->tk_offset && in gate_setup_timer()
282 clockid == gact->param.tcfg_clockid) in gate_setup_timer()
285 spin_unlock_bh(&gact->tcf_lock); in gate_setup_timer()
286 hrtimer_cancel(&gact->hitimer); in gate_setup_timer()
287 spin_lock_bh(&gact->tcf_lock); in gate_setup_timer()
289 gact->param.tcfg_basetime = basetime; in gate_setup_timer()
290 gact->param.tcfg_clockid = clockid; in gate_setup_timer()
291 gact->tk_offset = tko; in gate_setup_timer()
292 hrtimer_init(&gact->hitimer, clockid, HRTIMER_MODE_ABS_SOFT); in gate_setup_timer()
293 gact->hitimer.function = gate_timer_func; in gate_setup_timer()
309 struct tcf_gate *gact; in tcf_gate_init() local
381 gact = to_gate(*a); in tcf_gate_init()
383 INIT_LIST_HEAD(&gact->param.entries); in tcf_gate_init()
389 spin_lock_bh(&gact->tcf_lock); in tcf_gate_init()
390 p = &gact->param; in tcf_gate_init()
419 gate_setup_timer(gact, basetime, tk_offset, clockid, in tcf_gate_init()
423 gate_get_start_time(gact, &start); in tcf_gate_init()
425 gact->current_close_time = start; in tcf_gate_init()
426 gact->current_gate_status = GATE_ACT_GATE_OPEN | GATE_ACT_PENDING; in tcf_gate_init()
428 gact->next_entry = list_first_entry(&p->entries, in tcf_gate_init()
433 gate_start_timer(gact, start); in tcf_gate_init()
435 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_init()
443 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_init()
452 gate_setup_timer(gact, gact->param.tcfg_basetime, in tcf_gate_init()
453 gact->tk_offset, gact->param.tcfg_clockid, in tcf_gate_init()
461 struct tcf_gate *gact = to_gate(a); in tcf_gate_cleanup() local
464 p = &gact->param; in tcf_gate_cleanup()
465 hrtimer_cancel(&gact->hitimer); in tcf_gate_cleanup()
504 struct tcf_gate *gact = to_gate(a); in tcf_gate_dump() local
506 .index = gact->tcf_index, in tcf_gate_dump()
507 .refcnt = refcount_read(&gact->tcf_refcnt) - ref, in tcf_gate_dump()
508 .bindcnt = atomic_read(&gact->tcf_bindcnt) - bind, in tcf_gate_dump()
515 spin_lock_bh(&gact->tcf_lock); in tcf_gate_dump()
516 opt.action = gact->tcf_action; in tcf_gate_dump()
518 p = &gact->param; in tcf_gate_dump()
555 tcf_tm_dump(&t, &gact->tcf_tm); in tcf_gate_dump()
558 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_dump()
563 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_dump()
581 struct tcf_gate *gact = to_gate(a); in tcf_gate_stats_update() local
582 struct tcf_t *tm = &gact->tcf_tm; in tcf_gate_stats_update()