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]
Message-Id: <20160104.223459.1663440859688328335.davem@davemloft.net>
Date:	Mon, 04 Jan 2016 22:34:59 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	peppe.cavallaro@...com
Cc:	netdev@...r.kernel.org, alexandre.torgue@...com, david.mckay@...com
Subject: Re: [PATCH (net-next.git) 04/18] stmmac: remove modulo in
 stmmac_xmit()

From: Giuseppe Cavallaro <peppe.cavallaro@...com>
Date: Mon, 4 Jan 2016 14:06:49 +0100

> @@ -2056,7 +2068,10 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
>  	priv->hw->desc->set_tx_owner(first);
>  	wmb();
>  
> -	priv->cur_tx++;
> +	if (++entry >= txsize)
> +		entry = 0;

You are doing this over and over again, encapsulate it into a helper
like "NEXT_TX(x)" or similar.

Also, this is just fundamentally completely stupid.  Enforce the ring
size to be a power-of-2, then you can just go "x + 1 & (size - 1)" and
not even have the conditional statement.

Thanks.
--
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