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
68 int len = skb->len; in _hbm_out_cg() local
74 if (qsp != NULL && !qsp->loopback && (skb->ifindex == 1)) in _hbm_out_cg()
79 // We may want to account for the length of headers in len in _hbm_out_cg()
86 if (qdp->lasttime == 0) in _hbm_out_cg()
92 bpf_spin_lock(&qdp->lock); in _hbm_out_cg()
93 delta = qdp->lasttime - curtime; in _hbm_out_cg()
95 if (delta < -BURST_SIZE_NS) { in _hbm_out_cg()
97 qdp->lasttime = curtime - BURST_SIZE_NS; in _hbm_out_cg()
98 delta = -BURST_SIZE_NS; in _hbm_out_cg()
100 sendtime = qdp->lasttime; in _hbm_out_cg()
101 delta_send = BYTES_TO_NS(len, qdp->rate); in _hbm_out_cg()
102 __sync_add_and_fetch(&(qdp->lasttime), delta_send); in _hbm_out_cg()
103 bpf_spin_unlock(&qdp->lock); in _hbm_out_cg()
107 skb->tstamp = sendtime; in _hbm_out_cg()
110 if (qsp != NULL && (qsp->rate * 128) != qdp->rate) in _hbm_out_cg()
111 qdp->rate = qsp->rate * 128; in _hbm_out_cg()
116 len > LARGE_PKT_THRESH)) { in _hbm_out_cg()
139 } else if (len > LARGE_PKT_THRESH) { in _hbm_out_cg()
153 if (qsp != NULL && qsp->no_cn) in _hbm_out_cg()
156 hbm_update_stats(qsp, len, curtime, congestion_flag, drop_flag, in _hbm_out_cg()
160 __sync_add_and_fetch(&(qdp->lasttime), -delta_send); in _hbm_out_cg()