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()
121 struct tcf_gate *gact = to_gate(a); in tcf_gate_act() local
122 int action = READ_ONCE(gact->tcf_action); in tcf_gate_act()
124 tcf_lastuse_update(&gact->tcf_tm); in tcf_gate_act()
125 tcf_action_update_bstats(&gact->common, skb); in tcf_gate_act()
127 spin_lock(&gact->tcf_lock); in tcf_gate_act()
128 if (unlikely(gact->current_gate_status & GATE_ACT_PENDING)) { in tcf_gate_act()
129 spin_unlock(&gact->tcf_lock); in tcf_gate_act()
133 if (!(gact->current_gate_status & GATE_ACT_GATE_OPEN)) { in tcf_gate_act()
134 spin_unlock(&gact->tcf_lock); in tcf_gate_act()
138 if (gact->current_max_octets >= 0) { in tcf_gate_act()
139 gact->current_entry_octets += qdisc_pkt_len(skb); in tcf_gate_act()
140 if (gact->current_entry_octets > gact->current_max_octets) { in tcf_gate_act()
141 spin_unlock(&gact->tcf_lock); in tcf_gate_act()
145 spin_unlock(&gact->tcf_lock); in tcf_gate_act()
150 tcf_action_inc_overlimit_qstats(&gact->common); in tcf_gate_act()
152 tcf_action_inc_drop_qstats(&gact->common); in tcf_gate_act()
278 static void gate_setup_timer(struct tcf_gate *gact, u64 basetime, in gate_setup_timer() argument
283 if (basetime == gact->param.tcfg_basetime && in gate_setup_timer()
284 tko == gact->tk_offset && in gate_setup_timer()
285 clockid == gact->param.tcfg_clockid) in gate_setup_timer()
288 spin_unlock_bh(&gact->tcf_lock); in gate_setup_timer()
289 hrtimer_cancel(&gact->hitimer); in gate_setup_timer()
290 spin_lock_bh(&gact->tcf_lock); in gate_setup_timer()
292 gact->param.tcfg_basetime = basetime; in gate_setup_timer()
293 gact->param.tcfg_clockid = clockid; in gate_setup_timer()
294 gact->tk_offset = tko; in gate_setup_timer()
295 hrtimer_init(&gact->hitimer, clockid, HRTIMER_MODE_ABS_SOFT); in gate_setup_timer()
296 gact->hitimer.function = gate_timer_func; in gate_setup_timer()
312 struct tcf_gate *gact; in tcf_gate_init() local
384 gact = to_gate(*a); in tcf_gate_init()
386 INIT_LIST_HEAD(&gact->param.entries); in tcf_gate_init()
392 spin_lock_bh(&gact->tcf_lock); in tcf_gate_init()
393 p = &gact->param; in tcf_gate_init()
422 gate_setup_timer(gact, basetime, tk_offset, clockid, in tcf_gate_init()
426 gate_get_start_time(gact, &start); in tcf_gate_init()
428 gact->current_close_time = start; in tcf_gate_init()
429 gact->current_gate_status = GATE_ACT_GATE_OPEN | GATE_ACT_PENDING; in tcf_gate_init()
431 gact->next_entry = list_first_entry(&p->entries, in tcf_gate_init()
436 gate_start_timer(gact, start); in tcf_gate_init()
438 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_init()
446 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_init()
455 gate_setup_timer(gact, gact->param.tcfg_basetime, in tcf_gate_init()
456 gact->tk_offset, gact->param.tcfg_clockid, in tcf_gate_init()
464 struct tcf_gate *gact = to_gate(a); in tcf_gate_cleanup() local
467 p = &gact->param; in tcf_gate_cleanup()
468 hrtimer_cancel(&gact->hitimer); in tcf_gate_cleanup()
507 struct tcf_gate *gact = to_gate(a); in tcf_gate_dump() local
509 .index = gact->tcf_index, in tcf_gate_dump()
510 .refcnt = refcount_read(&gact->tcf_refcnt) - ref, in tcf_gate_dump()
511 .bindcnt = atomic_read(&gact->tcf_bindcnt) - bind, in tcf_gate_dump()
518 spin_lock_bh(&gact->tcf_lock); in tcf_gate_dump()
519 opt.action = gact->tcf_action; in tcf_gate_dump()
521 p = &gact->param; in tcf_gate_dump()
558 tcf_tm_dump(&t, &gact->tcf_tm); in tcf_gate_dump()
561 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_dump()
566 spin_unlock_bh(&gact->tcf_lock); in tcf_gate_dump()
574 struct tcf_gate *gact = to_gate(a); in tcf_gate_stats_update() local
575 struct tcf_t *tm = &gact->tcf_tm; in tcf_gate_stats_update()