lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 11 Dec 2011 00:58:22 +0100
From:	Florian Westphal <fw@...len.de>
To:	Hagen Paul Pfeifer <hagen@...u.net>
Cc:	netdev@...r.kernel.org, eric.dumazet@...il.com,
	shemminger@...tta.com, Florian Westphal <fw@...len.de>
Subject: Re: [PATCH] netem: add cell concept to simulate special MAC behavior

Hagen Paul Pfeifer <hagen@...u.net> wrote:
> +static psched_time_t packet_len_2_sched_time(unsigned int len, struct netem_sched_data *q)
>  {
[..]
> +	if (q->cell_size) {
> +		u32 cells = reciprocal_divide(len, q->cell_size_reciprocal);
> +		u32 mod_carry = len - cells * q->cell_size;
> +
> +		if (mod_carry)
> +			mod_carry = (len > q->cell_size || !cells) ?
> +				q->cell_size - mod_carry : len - mod_carry;
> +
> +		if (q->cell_overhead) {
> +			if (mod_carry)
> +				++cells;
> +			len += cells * q->cell_overhead;
> +		}
> +
> +		len += mod_carry;

Why did you chose to replace the previous version?

if (q->cell_size) {
      u32 cells = reciprocal_divide(len, q->cell_size_reciprocal);

      if (len > cells * q->cell_size)  /* extra cell needed for remainder */
                        cells++;
      len = cells * (q->cell_size + q->cell_overhead);
}

I think that it is a lot easier to read -- did you find a problem with it?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ