FreeBSD/sys/netpfil/ipfw/ip_dn_io.c
/*
 * Convert the additional MAC overheads/delays into an equivalent
 * number of bits for the given data rate. The samples are
 * in milliseconds so we need to divide by 1000.
 */
Convert the additional MAC overheads/delays into an equivalent
number of bits for the given data rate. The samples are
in milliseconds so we need to divide by 1000.
Convert the additional MAC overheads / delays into an equivalent number of bits for the given data rate . The samples are in milliseconds so we need to divide by 1000 .
static uint64_t
extra_bits(struct mbuf *m, struct dn_schk *s)
{
	int index;
	uint64_t bits;
	struct dn_profile *pf = s->profile;
	if (!pf || pf->samples_no == 0)
		return 0;
	index  = random() % pf->samples_no;
	bits = div64((uint64_t)pf->samples[index] * s->link.bandwidth, 1000);
	if (index >= pf->loss_level) {
		struct dn_pkt_tag *dt = dn_tag_get(m);
		if (dt)
			dt->dn_dir = DIR_DROP;
	}
	return bits;
}
static uint64_t extra_bits ( struct mbuf * m , struct dn_schk * s ) { int index ; uint64_t bits ; struct dn_profile * pf = s -> profile ; if ( ! pf || pf -> samples_no == 0 ) return 0 ; index = random ( ) % pf -> samples_no ; bits = div64 ( ( uint64_t ) pf -> samples [ index ] * s -> link . bandwidth , 1000 ) ; if ( index >= pf -> loss_level ) { struct dn_pkt_tag * dt = dn_tag_get ( m ) ; if ( dt ) dt -> dn_dir = DIR_DROP ; } return bits ; }
Convert the additional MAC overheads/delays into an equivalent
 number of bits for the given data rate.
Convert the additional MAC overheads / delays into an equivalent number of bits for the given data rate .