Lines Matching +full:len +full:- +full:or +full:- +full:limit

1 // SPDX-License-Identifier: GPL-2.0
4 * This program is free software; you can redistribute it and/or
10 * A cgroup skb BPF egress program to limit cgroup output bandwidth.
11 * It uses a modified virtual token bucket queue to limit average
20 * - <--------------------------|------------------------> +
45 * The default bandwidth limit is set at 1Gbps but this can be changed by
47 * program does not limit connections using loopback. This behavior can be
49 * some statistics, such as percent of packets marked or dropped, which
61 int len = skb->len; in _hbm_out_cg() local
76 if (qsp != NULL && !qsp->loopback && (skb->ifindex == 1)) in _hbm_out_cg()
81 // We may want to account for the length of headers in len in _hbm_out_cg()
88 else if (qdp->lasttime == 0) in _hbm_out_cg()
94 bpf_spin_lock(&qdp->lock); in _hbm_out_cg()
95 credit = qdp->credit; in _hbm_out_cg()
96 delta = curtime - qdp->lasttime; in _hbm_out_cg()
102 qdp->lasttime = curtime; in _hbm_out_cg()
103 new_credit = credit + CREDIT_PER_NS(delta, qdp->rate); in _hbm_out_cg()
109 credit -= len; in _hbm_out_cg()
110 qdp->credit = credit; in _hbm_out_cg()
111 bpf_spin_unlock(&qdp->lock); in _hbm_out_cg()
115 if (qsp != NULL && (qsp->rate * 128) != qdp->rate) { in _hbm_out_cg()
116 qdp->rate = qsp->rate * 128; in _hbm_out_cg()
118 (int)qdp->rate, in _hbm_out_cg()
119 CREDIT_PER_NS(1000000000, qdp->rate) * 8); in _hbm_out_cg()
124 if (credit < -DROP_THRESH || in _hbm_out_cg()
125 (len > LARGE_PKT_THRESH && credit < -LARGE_PKT_DROP_THRESH)) { in _hbm_out_cg()
135 if (credit < -MARK_THRESH) in _hbm_out_cg()
151 if (-credit >= MARK_THRESH + in _hbm_out_cg()
156 } else if (len > LARGE_PKT_THRESH) { in _hbm_out_cg()
164 if (qsp->no_cn) in _hbm_out_cg()
167 hbm_update_stats(qsp, len, curtime, congestion_flag, drop_flag, in _hbm_out_cg()
171 __sync_add_and_fetch(&(qdp->credit), len); in _hbm_out_cg()