FreeBSD/sys/netinet/ip_mroute.c
/*
 * Prepare a bandwidth-related upcall
 */
Prepare a bandwidth-related upcall
Prepare a bandwidth - related upcall
static void
bw_meter_prepare_upcall(struct bw_meter *x, struct timeval *nowp)
{
    struct timeval delta;
    struct bw_upcall *u;
    MFC_LOCK_ASSERT();
    delta = *nowp;
    BW_TIMEVALDECR(&delta, &x->bm_start_time);
    if (V_bw_upcalls_n >= BW_UPCALLS_MAX)
	bw_upcalls_send();
    u = &V_bw_upcalls[V_bw_upcalls_n++];
    u->bu_src = x->bm_mfc->mfc_origin;
    u->bu_dst = x->bm_mfc->mfc_mcastgrp;
    u->bu_threshold.b_time = x->bm_threshold.b_time;
    u->bu_threshold.b_packets = x->bm_threshold.b_packets;
    u->bu_threshold.b_bytes = x->bm_threshold.b_bytes;
    u->bu_measured.b_time = delta;
    u->bu_measured.b_packets = x->bm_measured.b_packets;
    u->bu_measured.b_bytes = x->bm_measured.b_bytes;
    u->bu_flags = 0;
    if (x->bm_flags & BW_METER_UNIT_PACKETS)
	u->bu_flags |= BW_UPCALL_UNIT_PACKETS;
    if (x->bm_flags & BW_METER_UNIT_BYTES)
	u->bu_flags |= BW_UPCALL_UNIT_BYTES;
    if (x->bm_flags & BW_METER_GEQ)
	u->bu_flags |= BW_UPCALL_GEQ;
    if (x->bm_flags & BW_METER_LEQ)
	u->bu_flags |= BW_UPCALL_LEQ;
}
static void bw_meter_prepare_upcall ( struct bw_meter * x , struct timeval * nowp ) { struct timeval delta ; struct bw_upcall * u ; MFC_LOCK_ASSERT ( ) ; delta = * nowp ; BW_TIMEVALDECR ( & delta , & x -> bm_start_time ) ; if ( V_bw_upcalls_n >= BW_UPCALLS_MAX ) bw_upcalls_send ( ) ; u = & V_bw_upcalls [ V_bw_upcalls_n ++ ] ; u -> bu_src = x -> bm_mfc -> mfc_origin ; u -> bu_dst = x -> bm_mfc -> mfc_mcastgrp ; u -> bu_threshold . b_time = x -> bm_threshold . b_time ; u -> bu_threshold . b_packets = x -> bm_threshold . b_packets ; u -> bu_threshold . b_bytes = x -> bm_threshold . b_bytes ; u -> bu_measured . b_time = delta ; u -> bu_measured . b_packets = x -> bm_measured . b_packets ; u -> bu_measured . b_bytes = x -> bm_measured . b_bytes ; u -> bu_flags = 0 ; if ( x -> bm_flags & BW_METER_UNIT_PACKETS ) u -> bu_flags |= BW_UPCALL_UNIT_PACKETS ; if ( x -> bm_flags & BW_METER_UNIT_BYTES ) u -> bu_flags |= BW_UPCALL_UNIT_BYTES ; if ( x -> bm_flags & BW_METER_GEQ ) u -> bu_flags |= BW_UPCALL_GEQ ; if ( x -> bm_flags & BW_METER_LEQ ) u -> bu_flags |= BW_UPCALL_LEQ ; }
Prepare a bandwidth-related upcall
Prepare a bandwidth - related upcall
/*
     * Compute the measured time interval
     */ /*
     * If there are too many pending upcalls, deliver them now
     */ /*
     * Set the bw_upcall entry
     */