Lines Matching refs:limit
112 static size_t bandwidth_limit(struct bw_limiter_st *limit, OSSL_TIME now, in bandwidth_limit() argument
119 if (limit->bw == 0) /* 0 -> no limit */ in bandwidth_limit()
126 for (i = 0; i < limit->num; i++) { in bandwidth_limit()
127 size_t idx = (limit->start + i) % MAX_PKTS_PER_WINDOW; in bandwidth_limit()
129 if (ossl_time_compare(limit->pinfos[idx].timestamp, sampling_start) >= 0) in bandwidth_limit()
131 limit->size_sum -= limit->pinfos[idx].size; in bandwidth_limit()
133 limit->start = (limit->start + i) % MAX_PKTS_PER_WINDOW; in bandwidth_limit()
134 limit->num -= i; in bandwidth_limit()
140 if ((limit->size_sum + pktsize) / SAMPLING_WINDOW_PERIOD > limit->bw) { in bandwidth_limit()
155 if (limit->num >= MAX_PKTS_PER_WINDOW) { in bandwidth_limit()
156 limit->size_sum -= limit->pinfos[limit->start].size; in bandwidth_limit()
157 limit->start = (limit->start + 1) % MAX_PKTS_PER_WINDOW; in bandwidth_limit()
159 ++limit->num; in bandwidth_limit()
161 end = (limit->start + limit->num) % MAX_PKTS_PER_WINDOW; in bandwidth_limit()
162 limit->pinfos[end].size = pktsize; in bandwidth_limit()
163 limit->pinfos[end].timestamp = now; in bandwidth_limit()
164 limit->size_sum += pktsize; in bandwidth_limit()