MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cc_ack_received

Function cc_ack_received

freebsd/netinet/tcp_input.c:312–381  ·  view source on GitHub ↗

* CC wrapper hook functions */

Source from the content-addressed store, hash-verified

310 * CC wrapper hook functions
311 */
312void
313cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs,
314 uint16_t type)
315{
316#ifdef STATS
317 int32_t gput;
318#endif
319
320 INP_WLOCK_ASSERT(tp->t_inpcb);
321
322 tp->ccv->nsegs = nsegs;
323 tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th);
324 if ((!V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd)) ||
325 (V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd) &&
326 (tp->snd_cwnd < (tcp_compute_pipe(tp) * 2))))
327 tp->ccv->flags |= CCF_CWND_LIMITED;
328 else
329 tp->ccv->flags &= ~CCF_CWND_LIMITED;
330
331 if (type == CC_ACK) {
332#ifdef STATS
333 stats_voi_update_abs_s32(tp->t_stats, VOI_TCP_CALCFRWINDIFF,
334 ((int32_t)tp->snd_cwnd) - tp->snd_wnd);
335 if (!IN_RECOVERY(tp->t_flags))
336 stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_ACKLEN,
337 tp->ccv->bytes_this_ack / (tcp_maxseg(tp) * nsegs));
338 if ((tp->t_flags & TF_GPUTINPROG) &&
339 SEQ_GEQ(th->th_ack, tp->gput_ack)) {
340 /*
341 * Compute goodput in bits per millisecond.
342 */
343 gput = (((int64_t)(th->th_ack - tp->gput_seq)) << 3) /
344 max(1, tcp_ts_getticks() - tp->gput_ts);
345 stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_GPUT,
346 gput);
347 /*
348 * XXXLAS: This is a temporary hack, and should be
349 * chained off VOI_TCP_GPUT when stats(9) grows an API
350 * to deal with chained VOIs.
351 */
352 if (tp->t_stats_gput_prev > 0)
353 stats_voi_update_abs_s32(tp->t_stats,
354 VOI_TCP_GPUT_ND,
355 ((gput - tp->t_stats_gput_prev) * 100) /
356 tp->t_stats_gput_prev);
357 tp->t_flags &= ~TF_GPUTINPROG;
358 tp->t_stats_gput_prev = gput;
359 }
360#endif /* STATS */
361 if (tp->snd_cwnd > tp->snd_ssthresh) {
362 tp->t_bytes_acked += tp->ccv->bytes_this_ack;
363 if (tp->t_bytes_acked >= tp->snd_cwnd) {
364 tp->t_bytes_acked -= tp->snd_cwnd;
365 tp->ccv->flags |= CCF_ABC_SENTAWND;
366 }
367 } else {
368 tp->ccv->flags &= ~CCF_ABC_SENTAWND;
369 tp->t_bytes_acked = 0;

Callers 1

tcp_do_segmentFunction · 0.85

Calls 7

tcp_compute_pipeFunction · 0.85
stats_voi_update_abs_s32Function · 0.85
stats_voi_update_abs_u32Function · 0.85
tcp_maxsegFunction · 0.85
maxFunction · 0.85
tcp_ts_getticksFunction · 0.70

Tested by

no test coverage detected